Migrate REST API clients from old Optimizer to New Optimizer Signbox

Migrate REST API clients from old Optimizer to New Optimizer Signbox

The changes between REST API old Optimizer and New Optimizer may require some smaller adjustaments of the client implementations, but are in general not requiring big-effort changes. This migration guide should give an overview on how to migrate from old Optimizer to New Optimizer.

 

 

Conceptual Changes

The new Optimizer is redefining the routing structure by transitioning from the previous format of all routes strictly using /api/v1 in the path component to a new format that utilizes /signbox/api/v1.

 


Changes in API Calls

Modified calls

POST /signbox/api/v1/sign

Previous endpoint: POST /api/sign
Current endpoint: POST /signbox/api/v1/sign

Introduced Parameters

The following parameters have been added to extend functionality and control:

  • certificate_check
    Validates the status of the signing certificate.

  • sessionid
    Identifier of the session previously opened with POST /signbox/api/v1/open_session.
    Required for certain digital identities.

  • useasync
    Enables the asynchronous signing flow.
    Asynchronous mode is active by default.

Timestamp Configuration

Previously, timestamp parameters were configured through an alias.ini file. These settings can now be included directly in the API request:

  • tsa_url – URL of the timestamp service (required for T or LTV-level signatures)

  • tsa_user – Billing username for the timestamp service

  • tsa_pass – Billing password for the timestamp service

Signature Appearance (New Parameter)

In earlier versions, image-related settings were provided as separate fields. These have now been centralized into a new parameter: signature_appearance.

This parameter allows you to define all visual aspects of the signature in JSON format.

Example of signature_appearance:

{ "text": [ "Firmado por: %(CN)s", "%(EMAIL)s %(L)s %(SUBJECT)s", "Fecha: %(DATE)s" ], "date": "%d/%m/%Y %H:%M:%S %z", "timezone": "America/Guatemala", "position": "30,100,165,150", "image": "be1cd133-8be5-4346-87de-d40afd90a3b9", "horizontal": true, "page": 0 }

All previous image configuration parameters should now be included within signature_appearance.

For a full list of available fields and options, please consult the API reference documentation

 

Added calls

The newly introduced calls therefore are:

OTP Management

  • POST /signbox/api/v1/open_session

  • POST /signbox/api/v1/close_session

Image Management

  • POST /signbox/api/v1/image

  • GET /signbox/api/v1/image/{image_uid}

  • DELETE /signbox/api/v1/image/{image_uid}

  • GET /signbox/api/v1/images

  • DELETE /signbox/api/v1/images

Token Management

  • POST /signbox/api/v1/token

  • GET /signbox/api/v1/token/{token_uid}

  • DELETE /signbox/api/v1/token/{token_uid}

  • GET /signbox/api/v1/tokens

Timestamp

  • POST /signbox/api/v1/timestamp


Changes in the response structure

Sign

The sign call now returns the following structure. Previously, it only included the ID of the process.

The new structure provides:

  • The signature status

  • A message confirming the creation of the process

  • A detail object including the status, signature format, environment, and job ID

Example response from sign call:

{     "status": "success",     "message": "New job process created",     "detail": {         "status": "created",         "format": "pades",         "env": "sandbox",         "jobid": "3448009e-b907-46ec-bab6-03009e012b80"     } }

 


Webhook (url_back) Notification

The webhook configured via url_back will receive a callback with the same structure as the main response, but with an updated message and status depending on the outcome of the signature process.

Example – Success Callback

{ "status": "success", "message": "Signature for job 84cd8c51-069f-4ea4-b73d-ce5a6580cc15 completed", "detail": { "status": "completed", "format": "PADES", "env": "sandbox", "jobid": "84cd8c51-069f-4ea4-b73d-ce5a6580cc15" } }

Example – Error Callback

In case of an error during the signing process, the webhook will also receive the same structure with status: "error" and a descriptive message:

{   "status": "error",   "message": "Error occurred while signing document: Cannot retrieve certificate for remote identity 25012632",   "detail": {     "status": "error",     "format": "PADES",     "env": "sandbox",     "jobid": "207b458b-89e3-4351-b945-5cd719b1bb61"   } }

This uniform structure allows for easier integration and consistent handling of all signature status updates—whether successful or failed.