Documents

For each digital signature request, you need to upload all documents to be signed in PDF format.

Verb Endpoint Action
POST /document/{pk} Upload a document
GET /document/{pk}/{type}/{uid} Retrieve a document
GET /document/{pk}/contract Retrieve the signature contract for this request
GET /documents/{pk} List documents uploaded for this request
DELETE /document/{pk}/{type}/{uid} Delete a document
DELETE /documents/{pk} Delete all documents uploaded for this request

Upload a document

Description

Upload a document and associate it to a given request. Documents added in this way can be signed by the user associated to the request through a call to the sign endpoint.

Endpoint

/api/v1/document/{pk}

Method

POST

Parameters
Body Parameters
Parameter Description Mandatory
file The actual document to upload Yes
Response

The response is a JSON object containing the uid assigned to the uploaded document:


                    {
                        "status": "200 OK",
                        "details": "a73b1253-838f-4340-8ae8-e0a1524f7472"
                    }
                

This uid is used to refer to this file in subsequent API calls. With it, you can retrieve, delete and sign the uploaded document.

Errors

If the uploaded document is not in pdf format, the server will reply with:


                    {
                        "status": "415 Unsupported Media Type",
                        "details": "Unsupported file type"
                    }
                
Example
curl -H "Content-Type: multipart/form-data" -F "file=@test.pdf" -X POST https://oneshot.demo.uanataca.com/api/v1/document/1460

                    {
                        "status": "200 OK",
                        "details": "9c74f5ae-4baf-487b-84b3-02fb80229a69"
                    }
                

Retrieve a document

Description

Retrieve the specified document

Endpoint

/api/v1/document/{pk}/original/{uid}

/api/v1/document/{pk}/signed/{uid}

Method

GET

Parameters

If the "original" endpoint is accessed, the call will return the file object as it was uploaded. Conversely, the "signed" endpoint will return the signed version of the document, if it exists (it is generated after calling the /sign endpoint).

Path Parameters
Parameter Description
pk The Request's unique identifier
uid The uid of the document
Response

Return the document in binary format.

Errors

If no document is found with the given uid, a HTTP 404 error is returned:


                    {
                        "status": "404 Not Found",
                        "details": "Document not found"
                    }
                
Example
curl --output file.pdf -X GET https://oneshot.demo.uanataca.com/api/v1/document/1460/original/96b43e1b-c1aa-45c4-9bed-8cb0b7b2efab
file.pdf:

                    %PDF-1.5
                    %µµµµ
                    1 0 obj
                    ...
                


Retrieve the signature contract

Description

Retrieve the digital signature contract document for a digital signature request.

Endpoint

/api/v1/document/{request-id}/contract

Method

GET

Parameters
Path Parameters
Parameter Description
request-id The Request's unique identifier
Response

Return the document in binary format. If you call this endpoint after calling the /sign API endpoint for the same signature request, the contract will be a digitally signed PDF.

If you call this endpoint before calling /sign for the request-id, you will get a plain unsigned PDF document instead. This is useful to show the contract to your user before it is signed.

Example
curl --output file.pdf -X GET https://oneshot.demo.uanataca.com/api/v1/document/1460/contract
file.pdf:

                    %PDF-1.5
                    %µµµµ
                    1 0 obj
                    ...
                

List documents

Description

List all uploaded documents associated to a Request.

Endpoint

/api/v1/documents/{pk}

Method

GET

Parameters
Path parameters
Parameter Description
pk The unique identifier for the Request
Response

Returns a JSON object listing the uploaded documents by uid and their details:


                    {
                        "status": "200 OK",
                        "details": {
                            "5f04778a-54f6-426a-b204-5573eb01e5da": {
                                "upload_date": "11/11/2019 18:03:07",
                                "ext": ".pdf",
                                "size": 128012,
                                "mime": "application/pdf",
                                "filename": "test-11.pdf"
                            },
                            "b1902f56-ca7b-4ef4-8741-242dc211c037": {
                                "upload_date": "11/11/2019 18:03:12",
                                "ext": ".pdf",
                                "size": 100337,
                                "mime": "application/pdf",
                                "filename": "test.pdf"
                            }
                        }
                    }
                
Example
curl -X GET https://oneshot.demo.uanataca.com/api/v1/documents/1460

Delete a document

Description

Delete the specified document

Endpoint

/api/v1/document/{pk}/original/{uid}

/api/v1/document/{pk}/signed/{uid}

Method

DELETE

Parameters

If the "original" endpoint is accessed, the call will delete the uploaded file object. Conversely, the "signed" endpoint deletes the signed version of the document, if it exists (it is generated after calling the /sign endpoint).

Path Parameters
Parameter Description
pk The Request's unique identifier
uid The uid of the document
Response

Returns a JSON object with the successful message:


                    {
                        "status": "200 OK",
                        "details": "Document successfully deleted"
                    }
                
Errors

If the document is not found, a HTTP 404 error is returned:


                    {
                        "status": "404 Not Found",
                        "details": "Document not found"
                    }
                
Example
curl -X DELETE https://oneshot.demo.uanataca.com/api/v1/document/1460/original/9c74f5ae-4baf-487b-84b3-02fb80229a69

                    {
                        "status": "200 OK",
                        "details": "Document successfully deleted"
                    }
                

Delete all documents

Description

Delete all existing documents for a Request (both uploaded and signed).

Endpoint

/api/v1/documents/{pk}

Method

DELETE

Parameters
Path parameters
Parameter Description
pk The Request's unique identifier
Response

Returns a JSON object with the successful message:


                    {
                        "status": "200 OK",
                        "details": "Documents deleted successfully"
                    }
                
Example
curl -X DELETE https://oneshot.demo.uanataca.com/api/v1/documents/1460

                    {
                        "status": "200 OK",
                        "details": "Documents deleted successfully"
                    }