> ## Documentation Index
> Fetch the complete documentation index at: https://sendforsign.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Create and fill in contract

> Create a contract and fill in its placeholders with your data in a single Sendforsign API request.

The best way to fill in contracts is to prepare a template that already contains all the necessary
placeholders in the text. This way, you can populate the necessary data in the right placeholders within
the contracts with a single API call.

> [!WARNING]
>
> Matching placeholders by `name` here is not reliable. To be sure every value lands, create the contract, then
> [list its placeholders](https://sendforsign.com/docs/api-reference/placeholder/list.md) and [update](https://sendforsign.com/docs/api-reference/placeholder/update.md) each one by
> the contract's `placeholderKey`. A contract created from a template gets new placeholder keys; match them to the
> template's placeholders by name.

### Body parameters

**data** `object` *required*

**child attribute**

**action** `string` *required*

Action type.

**clientKey** `string` *required*

Key of the client.

**userKey** `string`

ID of the user who create the contract. If not specified, the default user credentials will be used.

**contract** `object` *required*

Contract structure.

**child attribute**

**name** `string`

Name of the contract.

**templateKey** `string`

Template from which you are creating a contract.

**placeholders** `array`

Array of placeholders, optional.

**child attribute**

**placeholderKey** `string`

A placeholder key corresponds to a specific placeholder in the template from which you create a contract.
Use this parameter if you need to populate any value into this specific placeholder.

**name** `string`

Name of the placeholder.

**value** `string`

Value of the placeholder.

### Response

**contract** `string`

Contract structure.

**child attribute**

**createTime** `string`

Create time.

**contractKey** `string`

ID of the contract.

**code** `string`

The code of the answer.

**message** `string`

The message of the answer.

```bash cURL theme={null}
curl -X POST 'https://api.sendforsign.com/api/contract' \
     -H 'X-Sendforsign-Key: YOUR_API_KEY' \
     -H 'Content-Type: application/json' \
     -d '{
    "data": {
        "action": "create",
        "clientKey": "YOUR_CLIENT_KEY",
        "userKey": "USER_KEY",
        "contract": {
            "name": "New contract",
            "templateKey": "TEMPLATE_KEY"
        },
        "placeholders": [
            {
                "placeholderKey": "PLACEHOLDER_KEY",
                "value": "Placeholder value"
            },
            {
                "name": "Placeholder name",
                "value": "Placeholder value"
            }
        ]
    }
}'
```

```json Response theme={null}
     {
       "contract": {
                "createTime": "2023-12-01 12:18:55",
                "contractKey": "CONTRACT_KEY"
                 },
       "code": "201",
       "message": "Contract created"
    }
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.