Sign documents via API
Tuesday, October 13, 2020 at 01:14pmHello,
We are trying to have documents signed via the api in order to do some automated testing.
For signing documents we are using the following curl command. It returns 200, but they don't appear signed in the OneSpan dashboard
```curl -v -X POST -H "Authorization: Basic <token>" -H "Content-Type: application/json" -H "Accept: application/json" 'https://sandbox.esignlive.com/api/packages/Jyn28ySKgPlysjok3CPnukeEak8=/documents/signed_documents' -d '{ "documents": [ { "id": "903ca2d7ac4e14367d6af9cf0b768fd85e2ca48923493e55"}, {"id": "default-consent"}], "handdrawn": "AQAAAAIcDeoYTaHiVvjKkwDJLWb6AFAAAwADADkAAAADAAAA+gBQABoAAAACRQaAQAdiEkAeQBmChTITI4BQF1Aon1CBRAhErESGVFVQ6FCVUHNQc4iamYQ="}'```
We were listing the document ids within the package using:
```curl -H "Authorization: Basic <token>" -H "Content-Type: application/json" -H "Accept: application/json" 'https://sandbox.esignlive.com/api/packages/Jyn28ySKgPlysjok3CPnukeEak8=' | jq\n```
Any ideas on what we are missing to get the documents signed?
Reply to: Sign documents via API
Tuesday, October 13, 2020 at 01:35pmHi llorgon,
Please be aware that if you use API Key as credential when invoking API "POST /api/packages/Jyn28ySKgPlysjok3CPnukeEak8=/documents/signed_documents", it auto-signs for the Sender.
In order to sign on behalf of a Signer, you need three extra steps - (1)get signer authentication token (2)use signer auth token to exchange for a session token (3)add session token as cookie header "ESIGNLIVE_SESSION_ID={value}", instead of Authorization header.
The APIs used in the first two additional steps are documented in this guide.
Duo