Signature on server

Last review: 2022-01-22

Sign PDF and XML file with Viafirma API on server.

  • PDF format allowed: PADES_B, PADES_T,PADES_LT,PADES_LTA
  • XML format allowed: XADES_B, XADES_T, XADES_LT, XADES_LTA

synchronous method

Send documents and signature policy and get signed document. Recommended for low demand.

  • SERVICE: {urlbase}/documents/api/v3/messages/document/build
  • METHOD: POST
  • CONTENT/APPLICATION: JSON
{
  "groupCode" : "string",
  "externalCode" : "string",
  "notification" : {
    "text" : "string",
    "detail" : "string"
  },
  "document" : {
    "templateType": "string",
    "templateReference" : "string"
  },
  "policies" : [ {
    "signatures" : [ {
      "type" : "string",
      "typeFormatSign" : "string"
    } ]
  } ]
}

where:

groupCode: string (required)
externalCode: string (optional)

notification:

 text: string (optional)
 detail: string (optional)

document:

 templateType: string (required) [base64|url|messsage|uploaded]
 templateReference: string (required) [base64_value|URL_value|messageCode|token]

policies signatures:

 type: string (required) ['SERVER']
 typeFormatSign = (required) ['PADES_B'|'PADES_T'|'PADES_LT'|'PADES_LTA'|'XADES_B'|'XADES_T'|'XADES_LT'|'XADES_LTA']

Example:

{
  "groupCode" : "myGroup001",
  "externalCode" : "myContratNumber_001",
  "notification" : {
    "text" : "Test firma desatendida SÍNCRONA",
    "detail" : "Firma sin intervención de usuarios"
  },
  "document" : {
    "templateType": "uploaded",
    "templateReference" : "<..here your token..>"
  },
  "policies" : [ {
    "signatures" : [ {
      "type" : "SERVER",
      "typeFormatSign" : "PADES_B"
    } ]
  } ]
}

Respuesta

  • RESPONSE: 200 HTTP status code 200/OK
  • RESPONSE CONTENT TYPE: application/json
{
  "md5": "string",
  "fileName": "string",
  "base64": "string",
  "code": "string",
  "signedID": "string"
}
  • md5: MD5 file hash
  • fileName: filename
  • base64: base64
  • code: unique process messageCode
  • signedID: unique signature ID (a signature process can have a multiples signatures)

Error responses

    {
      "code": "string",
      "type": "string",
      "message": "string",
      "trace" : "string"
    }

asynchronous method

Send document and signature policy and get process ID. Recommended for high demand.

  • SERVICE: {urlbase}/documents/api/v3/messages/build
  • METHOD: POST
  • CONTENT/APPLICATION: JSON
{
  "groupCode" : "string",
  "externalCode" : "string",
  "notification" : {
    "text" : "string",
    "detail" : "string"
  },
  "document" : {
    "templateType": "string",
    "templateReference" : "string"
  },
  "policies" : [ {
    "signatures" : [ {
      "type" : "string",
      "typeFormatSign" : "string"
    } ]
  } ]
}

Where:

groupCode: string (required)
externalCode: string (optional)

notification:

 text: string (optional)
 detail: string (optional)

document:

 templateType: string (required) [base64|url|messsage|uploaded]
 templateReference: string (required) [base64_value|URL_value|messageCode|token]

policies signatures:

 type: string (required) ['SERVER']
 typeFormatSign = (required) ['PADES_B'|'PADES_T'|'PADES_LT'|'PADES_LTA'|'XADES_B'|'XADES_T'|'XADES_LT'|'XADES_LTA']

Example:

{
  "groupCode" : "myGroup001",
  "externalCode" : "myContratNumber_001",
  "notification" : {
    "text" : "Test firma desatendida SÍNCRONA",
    "detail" : "Firma sin intervención de usuarios"
  },
  "document" : {
    "templateType": "uploaded",
    "templateReference" : "<..here your token..>"
  },
  "policies" : [ {
    "signatures" : [ {
      "type" : "SERVER",
      "typeFormatSign" : "PADES_B"
    } ]
  } ]
}

Response

  • RESPONSE: 200 HTTP status code 200/OK
  • RESPONSE CONTENT TYPE: application/json
{
  "messageCode": "string"
}
  • messageCode: identificador único del proceso de firma con el que podrás consultar el estado y solicitar la descarga del documento firmado

Error responses

    {
      "code": "string",
      "type": "string",
      "message": "string",
      "trace" : "string"
    }

results matching ""

    No results matching ""