> For the complete documentation index, see [llms.txt](https://docs.autentique.com.br/api/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.autentique.com.br/api/mutations/assinando-um-documento.md).

# Signing a document

After creating a document, you can sign it using the `signDocument` mutation.\
\
The document will be signed on behalf of the owner of the API key used in the request. Therefore, this mutation must not be used to sign documents on behalf of other individuals.

```graphql
mutation SignDocument(
  $documentId: UUID!
  $organizationId: Int
) {
  signDocument(
    id: $documentId
    organization_id: $organizationId
  )
}
```

Variables:

```json
{
  "documentId": "DOCUMENT_UUID",
  "organizationId": null
}
```

If the operation is performed within an organization’s context, provide the organization ID:

```json
{
  "documentId": "UUID_DO_DOCUMENTO",
  "organizationId": 123
}
```

| Parameter         | Type    | Required | Description                                                                       |
| ----------------- | ------- | -------- | --------------------------------------------------------------------------------- |
| `id`              | `UUID!` | Yes      | Document UUID that will be signed                                                 |
| `organization_id` | `Int`   | No       | Identifier of the organization associated with the signature. Defaults to `null`. |

#### Return

The mutation returns a `Boolean` value:

```json
{
  "data": {
    "signDocument": true
  }
}
```

A value of `true` indicates that the document was signed successfully.

#### Before signing

The account associated with the API key must be included as one of the document’s signers. Otherwise, the API will return a `signature_not_found` error.

This mutation also cannot be used to allow other signers to sign directly within your application. It signs exclusively using the account associated with the API key. To collect signatures from other people, use the signature request or signing link flow.

***

You can test the signing process in [Altair](https://altair.autentique.com.br):

<figure><img src="/files/ufFTj9pY24sCFuFQVcBT" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
You can check what each of these parameters means directly in the full GraphQL API documentation, in the Docs menu of [Altair](https://altair.autentique.com.br/). If you're not sure how to do that, check out our tutorial on [**Using Altair**](/api/integration-basics/altair.md).
{% endhint %}

{% hint style="info" %}
If Altair doesn't help you integrate with the API, check out some examples of how to make these requests in other ways: <https://graphql.org/graphql-js/graphql-clients/>
{% endhint %}

{% file src="/files/-M03o9cE5QB3vLoPUlzJ" %}
Para importar e usar no Postman
{% endfile %}
