Skip to content

Create a new document

Request

Uploads a file and returns a document record you can reference from other resources — as the invoice or supporting paperwork on a payin or payout, or as evidence when responding to a request for information (RFI).

Send the request as multipart/form-data. The file must be a JPEG, PNG or PDF of at most 10 MB (10,485,760 bytes), and the uploaded filename and document_name at most 128 characters each.

Upload is a separate step from attaching, and each consumer names the reference differently: pass the returned id as document_id when creating a payin, an order or a refund, and inside the documents array when creating a payout or responding to an RFI. Check the schema of the endpoint you are attaching to — the key inside documents is not the same on every one. A document that is never referenced stays listed but has no effect.

Security
JWT
Bodymultipart/form-datarequired
document_namestringrequired

The name of the document

Example:"invoice"
filestring, (binary)required

The file to be uploaded. This should be sent as a binary in the multipart/form-data request.

curl -i -X POST \
  https://api.glomopay.com/api/v1/document \
  -H 'Authorization: Bearer <YOUR_JWT_HERE>' \
  -H 'Content-Type: multipart/form-data' \
  -F document_name=invoice \
  -F file=@file.bin

Responses

Document created successfully

Bodyapplication/json
idstringread-only

The unique identifier for the Document.

Example:"doc_nYUqLpuYQ0M8"
document_namestring

The name of document

Example:"invoice"
file_namestringread-only

The name of the file you uploaded.

Example:"invoice_BC8tFdE.pdf"
preview_urlstringread-only

The URL to preview the document.

Example:"https://glomopay-service-staging-documents.s3.ap-south-1.amazonaws.com/12345_invoice"
statusstringread-only

The status of file you uploaded. Values can be uploaded, approved and rejected.

Example:"uploaded"
created_atstring, (date-time)read-only

When the document was created, as an ISO 8601 date-time in UTC.

Example:"2021-06-01T12:00:00Z"
updated_atstring, (date-time)read-only

When the document was last updated, as an ISO 8601 date-time in UTC.

Example:"2021-06-01T12:00:00Z"
Response
{ "id": "doc_nYUqLpuYQ0M8", "document_name": "invoice", "file_name": "invoice_BC8tFdE.pdf", "preview_url": "https://glomopay-service-staging-documents.s3.ap-south-1.amazonaws.com/12345_invoice", "status": "uploaded", "created_at": "2021-06-01T12:00:00Z", "updated_at": "2021-06-01T12:00:00Z" }