...
The Gini Pay API currently supports two different variants of uploads, one optimized for web applications running in a web browser and the other for all other types of clients. The first variant optimized for web applications expects the documents to be uploaded using a multipart/form-data
encoding method. The second variant for all other clients simply uses the request body (independent of the request Content-Type
) as the document.
Code Block | ||
---|---|---|
| ||
//documents can be submitted by doing a POST request to the /documents resource.
POST /documents |
...
Supported file formats
Gini supports PDF files, GIF files (non-animated), PNG files, JPEG files, TIFF files as well as plain text formats. You can use native documents (PDF only) and scanned documents (all other supported formats).
...
Status Code | Description |
---|---|
400 (Bad Request) | Returned when a file is sent in an invalid format. |
401 (Unauthorized) | Authorization credentials are either missing, wrong or outdated. |
415 | Content type is not supported. |
503 | Service unavailable. Try again later. |
Code Block | ||
---|---|---|
| ||
//upload a document variant for web applications running in a web browser with access token: curl -H 'Authorization: BEARER <token>' --form 'file=@file.pdf' -H 'Accept: application/vnd.gini.v1+json' -i https://pay-api.gini.net/documents variant for all other types of applications: curl -H 'Authorization: BEARER <token>' --data-binary '@file.pdf' -H 'Accept: application/vnd.gini.v1+json' -H 'Content-Type: application/pdf' -i https://pay-api.gini.net/documents?filename=file.pdf or with X-User-identifier (see how to setup X-User-identifier): curl -H 'X-User-Identifier: user1' --form 'file=@file.pdf' -H 'Accept: application/vnd.gini.v1+json' -u 'client-id:client-secret' -i https://pay-api.gini.net/documents |
...
Upload a document page by page
...
Status Code | Description |
---|---|
400 (Bad Request) | Returned when the sent file has invalid format. |
401 (Unauthorized) | Authorization credentials are either missing, wrong or outdated. |
415 | Content type is not supported. |
503 | Service unavailable. Try again later. |
Code Block | ||
---|---|---|
| ||
//upload a partial document
//variant for web applications running in a web browser with access token:
curl -H 'Authorization: BEARER <token>'
--form 'file=@file.JPEG'
-H 'Accept: application/vnd.gini.v1+json'
-H 'Content-Type: application/vnd.gini.v1.partial+png'
-i https://pay-api.gini.net/documents
//variant for other types of applications with access token:
curl -H 'Authorization: BEARER <token>'
--data-binary '@file.JPEG'
-H 'Accept: application/vnd.gini.v1+json'
-H 'Content-Type: application/vnd.gini.v1.partial+png'
-i https://pay-api.gini.net/documents?filename=file.JPEG
//or with X-User-identifier (see how to setup X-User-identifier):
curl -H 'X-User-Identifier: user1'
--form 'file=@file.JPEG'
-H 'Accept: application/vnd.gini.v1+json'
-H 'Content-Type: application/vnd.gini.v1.partial+png'
-u 'client-id:client-secret'
-i https://pay-api.gini.net/documents |
Step 2 (upload JSON as a composite document)
...
Status Code | Description |
---|---|
400 (Bad Request) | Returned when a file in an invalid format is sent |
401 (Unauthorized) | Authorization credentials are either missing, wrong or outdated. |
415 | Content type not supported. |
503 | Service unavailable. Try again later. |
Code Block |
---|
//upload a composite document
//variant for web applications running in a web browser with access token:
curl -H 'Authorization: BEARER <token>'
-H 'Accept: application/vnd.gini.v1+json'
-H 'Content-Type: application/vnd.gini.v1.composite+json'
-X POST -d'{...}'
-i https://pay-api.gini.net/documents
//or
curl -H 'Authorization: BEARER <token>'
--data-binary '@data.json'
-H 'Accept: application/vnd.gini.v1+json'
-H 'Content-Type: application/vnd.gini.v1.composite+json'
-i https://pay-api.gini.net/documents
//or with X-User-identifier (see how to setup X-User-identifier):
curl -H 'X-User-Identifier: user1'
-H 'Accept: application/vnd.gini.v1+json'
-H 'Content-Type: application/vnd.gini.v1.composite+json'
-u 'client-id:client-secret'
-X POST - d'{...}'
-i https://pay-api.gini.net/documents
//with post body of
{
"partialDocuments": [
{
"rotationDelta": 0,
"document": "localtion of parital doc 1"
},
{
"rotationDelta": 0,
"document": "location of partial doc 2"
},
...
]
}
//location in form of https://pay-api.gini.net/documents/e8606210-56ed-11ea-b823-b351b84ae4b3 |