---
title: "Add metadata to a document"
url: "https://docs.signnow.com/docs/document/operations/put-document-document_id-metadata"
type: "endpoint"
section: "document"
slug: "document/operations/put-document-document_id-metadata"
method: "PUT"
path: "/document/{document_id}/metadata"
operation_id: "put-document-document_id-metadata"
authorization: "bearer"
---

# Add metadata to a document

`PUT /document/{document_id}/metadata`

This endpoint allows users to add metadata to the selected document. All added metadata will be linked to the document during the [invite to sign](/docs/document-field-invite/operations/post-field_invite). Also, if you'd like to use this metadata in any event subscription, you can add upon [creating a webhook](/docs/basic-auth/operations/create-event-subscription).

## Authorization

bearer

## Path Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `document_id` | string | Yes | ID of the document. |

## Header Parameters

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

## Request Body

**Schema**

```json
{
  "type": "object",
  "required": [
    "source"
  ],
  "properties": {
    "key": {
      "type": "string",
      "description": "Any type of metadata that should be added to the document. For example,`signer_id`."
    },
    "key1": {
      "type": "string",
      "description": "Any type of metadata that should be added to the document. For example, `timestamp`."
    },
    "key2": {
      "type": "string",
      "description": "Any type of metadata that should be added to the document. For example, `document_owner_id`."
    },
    "source": {
      "type": "string",
      "description": "The object that uses this metadata. Allowed values: `webhook`."
    }
  },
  "x-examples": {
    "Example 1": {
      "key": "value",
      "key1": "value",
      "key2": "value",
      "source": "webhook"
    }
  }
}
```

**Example** (`Example 1`)

```json
{
  "key": "value",
  "key1": "value",
  "key2": "value",
  "source": "webhook"
}
```

## Responses

### 200

Correct request

**Example** (`Correct request`)

```json
{
  "success": true
}
```

### 400

* Incorrect or missing token
* Request with bearer token from another user
* Request without `source` key
* `source` is not a string

**Example** (`source not string`)

```json
{
  "errors": [
    {
      "code": 65916,
      "message": "Source must be a string"
    }
  ]
}
```

**Example** (`Another user's token`)

```json
{
  "errors": [
    {
      "code": 65610,
      "message": "not readable"
    }
  ]
}
```

**Example** (`Request without source`)

```json
{
  "errors": [
    {
      "code": 65916,
      "message": "Source must not be empty"
    }
  ]
}
```

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

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

## Code Examples

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

### cURL

```bash
curl -X PUT \
  "https://api.signnow.com/document/{document_id}/metadata" \
  -H "Authorization: Bearer $SIGNNOW_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"key": "value", "key1": "value", "key2": "value", "source": "webhook"}'
```

---
*Full reference: https://docs.signnow.com/docs/document/operations/put-document-document_id-metadata*
