API Reference
v1.7.3
Search
K

Upload image attachment

post
https://api.complycube.com
/v1/documents/:id/upload/:documentSide
Upload an image attachment
Associates an image attachment to an existing document. The images must be either in JPG, PNG, or PDF format. Each side of the document must be between 34 KB and 4 MB.
Parameters
Path
documentSide*
string
The side of document being attached. Valid values include: 1. front 2. back
id*
string
The ID of the document.
Header
Content-Type*
string
The content-type must always be set to application/json.
Authorization*
string
The API live or test key.
Body
fileName*
string
The file name. It must end with .jpg, .jpeg, .png, or .pdf.
data*
string
The BASE64 encoded data.
Responses
200
Document attachment successfully uploaded.
400
An example of a Bad Request response, when a tiny attachment, smaller than 34 KB, is provided.

Example request

cURL
Node.js
Python
PHP
.NET
curl -X POST https://api.complycube.com/v1/documents/{:documentId}/upload/{:documentSide} \
-H 'Authorization: <YOUR_API_KEY>' \
-H 'Content-Type: application/json' \
-d '{
"fileName": "front-test.jpg",
"data": "<BASE64_DATA_CONTENT>"
}'
const { ComplyCube } = require("@complycube/api");
const complycube = new ComplyCube({ apiKey: "<YOUR_API_KEY>" });
await complycube.document.upload("DOCUMENT_ID", {
fileName: "front-test.jpg",
data: "<BASE64_DATA_CONTENT>"
}, "DOCUMENT_SIDE");
from complycube import ComplyCubeClient
cc_api = ComplyCubeClient(api_key='<YOUR_API_KEY>')
doc_front = {
'fileName': 'passport_front.jpg',
'data': '<BASE_64_ENCODED>'
}
img = cc_api.documents.upload('DOCUMENT_ID','DOCUMENT_SIDE',**doc_front)
use ComplyCube\ComplyCubeClient;
$ccapi = new ComplyCubeClient('<YOUR_API_KEY>');
$img = $ccapi->documents()->upload('DOCUMENT_ID',
'front',
['fileName' => 'passport_front.jpg',
'data' => '<BASE64_CONTENT>']);
using ComplyCube.Net;
using ComplyCube.Net.Resources.Documents;
using ComplyCube.Net.Resources.Images;
var docApi = new DocumentApi(new ComplyCubeClient("<YOUR_API_KEY>"));
var docFront = new ImageRequest
{
fileName = "front-test.jpg",
data= "<BASE64_CONTENT>"
};
var img = await docApi.UploadImageAsync("DOCUMENT_ID", "front", docFront);