Use envelope
POST
/envelope/use
const url = 'https://app.legaldoc.com/api/v2/envelope/use';const form = new FormData();form.append('payload', '{ "envelopeId": "example", "externalId": "example", "recipients": [ { "id": 1, "email": "", "name": "example", "signingOrder": 1 } ], "distributeDocument": true, "customDocumentData": [ { "identifier": "example", "envelopeItemId": "example" } ], "folderId": "example", "prefillFields": [ { "id": 1, "type": "text", "label": "example", "placeholder": "example", "value": "example" } ], "override": { "title": "example", "subject": "example", "message": "example", "timezone": "example", "dateFormat": "yyyy-MM-dd hh:mm a", "redirectUrl": "example", "distributionMethod": "EMAIL", "emailSettings": { "recipientSigningRequest": true, "recipientRemoved": true, "recipientSigned": true, "documentPending": true, "documentCompleted": true, "documentDeleted": true, "ownerDocumentCompleted": true, "ownerRecipientExpired": true, "ownerDocumentCreated": true }, "language": "de", "typedSignatureEnabled": true, "uploadSignatureEnabled": true, "drawSignatureEnabled": true, "allowDictateNextSigner": true, "envelopeExpirationPeriod": { "unit": "day", "amount": 1 } }, "attachments": [ { "label": "example", "data": "https://example.com", "type": "link" } ], "formValues": { "additionalProperty": "example" } }');form.append('files', 'example');
const options = {method: 'POST', headers: {Authorization: '<Authorization>'}};
options.body = form;
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://app.legaldoc.com/api/v2/envelope/use \ --header 'Authorization: <Authorization>' \ --header 'Content-Type: multipart/form-data' \ --form 'payload={ "envelopeId": "example", "externalId": "example", "recipients": [ { "id": 1, "email": "", "name": "example", "signingOrder": 1 } ], "distributeDocument": true, "customDocumentData": [ { "identifier": "example", "envelopeItemId": "example" } ], "folderId": "example", "prefillFields": [ { "id": 1, "type": "text", "label": "example", "placeholder": "example", "value": "example" } ], "override": { "title": "example", "subject": "example", "message": "example", "timezone": "example", "dateFormat": "yyyy-MM-dd hh:mm a", "redirectUrl": "example", "distributionMethod": "EMAIL", "emailSettings": { "recipientSigningRequest": true, "recipientRemoved": true, "recipientSigned": true, "documentPending": true, "documentCompleted": true, "documentDeleted": true, "ownerDocumentCompleted": true, "ownerRecipientExpired": true, "ownerDocumentCreated": true }, "language": "de", "typedSignatureEnabled": true, "uploadSignatureEnabled": true, "drawSignatureEnabled": true, "allowDictateNextSigner": true, "envelopeExpirationPeriod": { "unit": "day", "amount": 1 } }, "attachments": [ { "label": "example", "data": "https://example.com", "type": "link" } ], "formValues": { "additionalProperty": "example" } }' \ --form files=exampleCreate a document envelope from a template envelope. Upload custom files to replace the template PDFs and map them to specific envelope items using identifiers.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”Media typemultipart/form-data
object
payload
required
object
envelopeId
required
string
externalId
string
recipients
distributeDocument
boolean
customDocumentData
folderId
string
prefillFields
Array
object
id
required
number
One of:
object
type
required
string
label
string
placeholder
string
value
string
object
type
required
string
label
string
placeholder
string
value
string
object
type
required
string
label
string
value
string
object
type
required
string
label
string
value
Array<string>
object
type
required
string
label
string
value
string
object
type
required
string
value
string
override
object
title
string
subject
string
message
string
timezone
string
dateFormat
string
redirectUrl
string
distributionMethod
string
emailSettings
object
recipientSigningRequest
boolean
recipientRemoved
boolean
recipientSigned
boolean
documentPending
boolean
documentCompleted
boolean
documentDeleted
boolean
ownerDocumentCompleted
boolean
ownerRecipientExpired
boolean
ownerDocumentCreated
boolean
language
string
typedSignatureEnabled
boolean
uploadSignatureEnabled
boolean
drawSignatureEnabled
boolean
allowDictateNextSigner
boolean
attachments
Array<object>
object
label
required
string
data
required
string format: uri
type
string
files
Array<string>
Responses
Section titled “Responses”Successful response
Media typeapplication/json
object
id
required
string
recipients
required
Array<object>
object
id
required
number
name
required
string
email
required
string
token
required
string
role
required
string
signingOrder
required
number | null
signingUrl
required
string
Example
{ "recipients": [ { "role": "CC" } ]}Invalid input data
Media typeapplication/json
object
message
required
string
code
required
string
issues
Array<object>
object
message
required
string
Examplegenerated
{ "message": "example", "code": "example", "issues": [ { "message": "example" } ]}Authorization not provided
Media typeapplication/json
object
message
required
string
code
required
string
issues
Array<object>
object
message
required
string
Examplegenerated
{ "message": "example", "code": "example", "issues": [ { "message": "example" } ]}Insufficient access
Media typeapplication/json
object
message
required
string
code
required
string
issues
Array<object>
object
message
required
string
Examplegenerated
{ "message": "example", "code": "example", "issues": [ { "message": "example" } ]}Internal server error
Media typeapplication/json
object
message
required
string
code
required
string
issues
Array<object>
object
message
required
string
Examplegenerated
{ "message": "example", "code": "example", "issues": [ { "message": "example" } ]}