---
title: "Add smart fields to template"
url: "https://docs.signnow.com/docs/smart-fields/operations/add-smart-fields-to-template-integraion-objects"
type: "endpoint"
section: "smart-fields"
slug: "smart-fields/operations/add-smart-fields-to-template-integraion-objects"
method: "POST"
path: "/document/{template_id}/integration_objects"
operation_id: "add-smart-fields-to-template-integraion-objects"
authorization: "bearer"
---

# Add smart fields to template

`POST /document/{template_id}/integration_objects`

Allows API users to add smart fields to a template - fillable fields in the template mapped with the fields in a CSV file. With smart fields, users can have their documents generated from a template and pre-filled automatically with data from a CSV file (spreadsheet) before sending.

## Authorization

bearer

## Path Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `template_id` | string | Yes | ID of the template |

## Header Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `Content-Type` | string | Yes | application/json |

## Request Body

**Schema**

```json
{
  "type": "object",
  "required": [
    "integration_objects"
  ],
  "properties": {
    "integration_objects": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "page_number",
          "font",
          "data",
          "api_integration_id",
          "size",
          "x",
          "y"
        ],
        "properties": {
          "x": {
            "type": "integer",
            "maximum": 16777215,
            "minimum": 0,
            "description": "X coordinates of a pixel on the page where the smart field should be placed.",
            "exclusiveMaximum": true
          },
          "y": {
            "type": "integer",
            "maximum": 16777215,
            "minimum": 0,
            "description": "X coordinates of a pixel on the page where the smart field should be placed.",
            "exclusiveMaximum": true
          },
          "data": {
            "type": "string",
            "description": "The name of the smart field."
          },
          "font": {
            "type": "string",
            "description": "Font for the text in the smart field. Possible values: `Arial`, `Times New Roman`, `Courier New`, `Tahoma`, and `Comic Sans MS`."
          },
          "size": {
            "type": "integer",
            "maximum": 2147483647,
            "minimum": 0,
            "description": "Font size for the text in the field.",
            "exclusiveMaximum": true
          },
          "width": {
            "type": "number",
            "maximum": 16777215,
            "minimum": 0,
            "description": "Field width",
            "x-stoplight": {
              "id": "t9u1avlii4wr1"
            },
            "exclusiveMaximum": true
          },
          "height": {
            "type": "number",
            "maximum": 16777215,
            "minimum": 0,
            "description": "Field height",
            "x-stoplight": {
              "id": "395a74spbplk9"
            },
            "exclusiveMaximum": true
          },
          "page_number": {
            "type": "integer",
            "minimum": 0,
            "description": "The page in the document where the smart field should be placed."
          },
          "api_integration_id": {
            "type": "string",
            "description": "Always set to `b98fc00add6b43a606bc527c81eee741bf16a7d8`"
          }
        }
      },
      "description": "Array of Smart Field objects."
    }
  }
}
```

**Example** (`Example 1`)

```json
{
  "integration_objects": [
    {
      "x": 217,
      "y": 32,
      "data": "First name",
      "font": "Arial",
      "size": 12,
      "page_number": 0,
      "api_integration_id": "b98fc00add6b43a606bc527c81eee741bf16a7d8"
    }
  ]
}
```

## Responses

### 200

Returns a new document ID in SignNow.

**Example** (`application/json`)

```json
{
  "id": "3dXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
}
```

### 400

* Incorrect or missing token
* Incorrect payload
* User doesn’t own the document
* Document is a part of a document group that is being changed
* `integration_objects` not an array
* Empty `integration_objects`
* `api_integration_id` is not a string
* `api_integration_id` is not found
* Incorrect `color` format
* `bold`, `italic`, or `underline` is not a boolean
* `line_height` is not numeric
* `line_height` is less than 0 or greater than 999.99
* `size` is not numeric
* Empty `size`
* `size` is less than 0 or greater than 2147483647
* `x` or `y` is not numeric
* Empty `x` or `y`
* `x` or `y` is less than 0
* `x` or `y` is greater than 16777215
* `data` is not a string
* Empty `data`
* `data` contains an ampersand (&)
* `height` or `width` is not an integer
* `height` or `width` is not within the 0-16777215 range
* `font` is not a string
* Empty `font`
* `page_number` is not an integer
* Empty `page_number`
* `page_number` is less than 0

**Example** (`Empty x`)

```json
{
  "code": 66014,
  "message": "X must not be empty"
}
```

**Example** (`Empty y`)

```json
{
  "code": 66015,
  "message": "Y must not be empty"
}
```

**Example** (`Empty data`)

```json
{
  "code": 66008,
  "message": "Data must not be empty"
}
```

**Example** (`Empty font`)

```json
{
  "code": 66016,
  "message": "Font must not be empty"
}
```

**Example** (`Empty size`)

```json
{
  "code": 66017,
  "message": "Size must not be empty"
}
```

**Example** (`x less than 0`)

```json
{
  "code": 65582,
  "message": "Invalid data provided for X"
}
```

**Example** (`x not numeric`)

```json
{
  "code": 66014,
  "message": "X must be numeric."
}
```

**Example** (`y not numeric`)

```json
{
  "code": 66015,
  "message": "Y must be numeric."
}
```

**Example** (`Incorrect width`)

```json
{
  "code": 65582,
  "message": "The `width` should be between 1 and 16777215."
}
```

**Example** (`data not string`)

```json
{
  "code": 66008,
  "message": "Data must be a string"
}
```

**Example** (`font not string`)

```json
{
  "code": 66016,
  "message": "Font must be string."
}
```

**Example** (`Incorrect height`)

```json
{
  "code": 65582,
  "message": "The `height` should be between 1 and 16777215."
}
```

**Example** (`bold not boolean`)

```json
{
  "code": 65582,
  "message": "The bold attribute must be boolean"
}
```

**Example** (`size less than 0`)

```json
{
  "code": 66017,
  "message": "Size must not be less than 0."
}
```

**Example** (`size not numeric`)

```json
{
  "code": 66017,
  "message": "Size must be numeric."
}
```

**Example** (`Empty page_number`)

```json
{
  "code": 66013,
  "message": "Page number must not be empty"
}
```

**Example** (`Incorrect payload`)

```json
{
  "code": 65536,
  "error": "Invalid payload"
}
```

**Example** (`width not integer`)

```json
{
  "code": 65582,
  "message": "The `width` should be of type integer."
}
```

**Example** (`height not integer`)

```json
{
  "code": 65582,
  "message": "The `height` should be of type integer."
}
```

**Example** (`italic not boolean`)

```json
{
  "code": 65582,
  "message": "The italic attribute must be boolean"
}
```

**Example** (`underline not boolean`)

```json
{
  "code": 65582,
  "message": "The underline attribute must be boolean"
}
```

**Example** (`Incorrect color format`)

```json
{
  "code": 65582,
  "message": "The color attribute format is invalid"
}
```

**Example** (`data contains ampersand`)

```json
{
  "code": 66008,
  "message": "Data must not contain ampersand character"
}
```

**Example** (`line_height less than 0`)

```json
{
  "code": 66018,
  "message": "Line height must not be less than 0."
}
```

**Example** (`line_height not numeric`)

```json
{
  "code": 66018,
  "message": "Line height must be numeric."
}
```

**Example** (`page_number less than 0`)

```json
{
  "code": 66013,
  "message": "Page number must not be less then 0."
}
```

**Example** (`page_number not integer`)

```json
{
  "code": 66013,
  "message": "Page number must be numeric."
}
```

**Example** (`y greater than 16777215`)

```json
{
  "code": 65582,
  "message": "Invalid data provided for Y"
}
```

**Example** (`Empty integration_objects`)

```json
{
  "code": 65536,
  "message": "Integration objects array is required."
}
```

**Example** (`User doesn't own document`)

```json
{
  "code": 65610,
  "message": "not writable"
}
```

**Example** (`Incorrect or missing token`)

```json
{
  "code": 1537,
  "error": "invalid_token"
}
```

**Example** (`api_integration_id not found`)

```json
{
  "code": 65582,
  "message": "Api integration not found"
}
```

**Example** (`size greater than 2147483647`)

```json
{
  "code": 65582,
  "message": "Invalid data provided for size"
}
```

**Example** (`Doc group in correction state`)

```json
{
  "code": 65582,
  "message": "Document group in correction state."
}
```

**Example** (`api_integration_id not string`)

```json
{
  "code": 66011,
  "message": "Invalid api_integration_id"
}
```

**Example** (`integration_objects not array`)

```json
{
  "code": 65536,
  "message": "Integration objects must be an array."
}
```

**Example** (`line_height greater than 99.999`)

```json
{
  "code": 65582,
  "message": "Invalid data provided for line_height"
}
```

### 404

Document not found

**Example** (`Example 1`)

```json
{
  "errors": [
    {
      "code": 65582,
      "message": "Document not found"
    }
  ]
}
```

## Code Examples

> Replace `$SIGNNOW_ACCESS_TOKEN` and any `{placeholder}` values before running.

### cURL

```bash
curl -X POST \
  "https://api.signnow.com/document/{template_id}/integration_objects" \
  -H "Authorization: Bearer $SIGNNOW_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"integration_objects": [{"x": 217, "y": 32, "data": "First name", "font": "Arial", "size": 12, "page_number": 0, "api_integration_id": "b98fc00add6b43a606bc527c81eee741bf16a7d8"}]}'
```

---
*Full reference: https://docs.signnow.com/docs/smart-fields/operations/add-smart-fields-to-template-integraion-objects*
