Home > API Reference > Document Package > Upload Document

Upload Document

Business applications can use this service API to add a document to a document package linked to an enterprise user’s account. The document information is sent in the HTTP request header and document bytes are sent in the HTTP request body.  Note SigningHub will convert supported document formats to PDF if the header "x-convert-document" is set to a value of "true".  The only case supported where this value is set to "false" is to retain Word format and XML documents.

SigningHub supports a wide variety of document formats, each of which can be converted to PDF format upon upload.  Click here for the full list.

Note PDF documents are not altered upon upload to the system.

Note a package must already exist before you can add a document using this call.

https://api.signinghub.com/v3/packages/{package_id}/documents

HTTP Verb

POST

Content–Type

application/octet-stream

Accept

application/json

Authorization

Bearer {access token}

x-file-name

Test file.pdf

x-convert-document (optional)

true

x-source

API

Request Body

file (binary Stream)

Status Code

Message

Response Body

201

Created

{
 "documentid": 123
}

400

Bad Request

{
  "Message": "Request does not contain document"
}
{
  "Message": "Invalid request headers - file name not found"
}
{
  "Message": "Only XML document can be uploaded for a workflow which contains at least one XML document"
}

401

Unauthorized

{
  "Message": "Request authorization denied"
}
{
  "Message": "User authentication required"
}

403

Forbidden

{
  "Message": "Enterprise admin's role does not allow managing integration"
}
{
 "Message": "You are not allowed to perform the requested operation"
}
{
  "Message": "Account is disabled"
}
{
  "Message": "Your storage limit has been reached"
}
{
   "Message": "Could not upload file  -  it is infected by malware"
}
{
  "Message": "Your document upload size limit has been reached"
}

500

Internal Server Error

{
  "Message": "An internal server error occurred while processing the request"
}

The detail of each item provided in the request and response is provided below:

 Item Details
 Names
 Description
 Request Parameters
 access_token The access token obtained as a result of successful authentication. If "scope" parameter was used in authentication request, then this service requires the access token to be obtained using the credentials of an Enterprise admin whose enterprise role has the application integration privileges.

 package_id Package ID of the package to which  the document is being added. 

 x-file-name
It's the name of file with extension.

 x-convert-document (optional)
This identifies whether to convert the document to a PDF or if it should be retained in its original format.  Note the only original format supported is currently Word & XML. All other document types will result in an error if this header value is set to "false".  If uploading a PDF document this Header can be omitted.

 x-source
This is the identification of the source of the document from where the document is uploaded, e.g. "My App".

 file(binary)
This is the document in the raw binary format.

 Response Parameters
 document_id
The document ID to be used later to share, download and get status of the document.

 Message The service specific error message returned by the API. This message provides useful information about why the service has returned an error response.



See also
Add Package
Rename Package
Add Document from Library
Apply Workflow Template
Share Document Package
Change Document Package Owner
Get Document Details
Get Document Image
Get Document Image (base64)
Download Document
Download Document (base64)
Rename Document
Delete Document
Get Certify Policy for a document
Update Certify Policy for a document
Get Package Verification
Get Document Verification
Change Document Order
Get Packages
Delete Package
Download Package
Download Package (base64)
Open Document Package
Close Document Package