# Create a Signature Definition

# Alias

`DocumentSignerCreation`

# Description

Creates a signature definition in a document and signature definitions resource. The defined signature is performed on the document contained in the resource.

Important

If the document and signature definitions resource in which the signature definition is created already contains signature definitions, the signatures corresponding to each of the definitions must be performed sequentially. i.e., without interweaving the operations for obtaining the hash of the document with operations for inserting the digital signature corresponding to different signature definitions.

# Request

`POST /trustedx-resources/esignsp/v2/documents/{doc_and_sigdefs_id}/signers`

## Parameters

Name | Type | Usage | Description
`doc_and_sigdefs_id` | path | Required | Identifier of the document and signature definitions resource in which a signature definition is to be created.

## Authorization

The request must contain a bearer access token generated by an authorization server of the platform. This token must have a scope that includes the `urn:safelayer:eidas:sign:process:document` value and must be used as explained in RFC 6750. Basically, the access token must be included in an `Authorization` header as follows:

`Authorization: Bearer <token>`

The client application must obtain the required access token via a client credentials grant OAuth 2.0 interaction with the platform.

## Content-Type Header

`Content-Type: application/json`

## Body

Signature definition to be created.

# Response

## Status-Line

If the signature definition is created successfully, the HTTP response will contain the following `Status-Line` (see HTTP Response Status for all the possible cases).

`HTTP/1.1 201 Created`

## Location Header

URL of the signature definition created. This URL has the following structure:

`Location: https://<host>:<port>/trustedx-resources/esignsp/v2/documents/{doc_and_sigdefs_id}/signers/{signature_definition_id}`

Where `{doc_and_sigdefs_id}` is the identifier of the document and signature definitions resource in which the signature definition was created and `{signature_definition_id}` is the identifier of this definition.

## Content-Type Header

`Content-Type: application/json`

## Body

Contains a JSON object with the following structure:

`{`
`"id" : {string},`
`"self" : {string}`
`}`

Property | Description
`id` | Identifier of the signature definition created.
`self` | URL of the signature definition created.

## Example

`HTTP/1.1 201 Created`
`Location: http://www.example.com/trustedx-resources/esignsp/v2/documents/idd_111/signers/ids_222`
`Content-Type: application/json`
`{`
`id" : "ids_222",`
`self" : "http://www.example.com/trustedx-resources/esignsp/v2/documents/idd_111/signers/ids_222"`
`}`