Create a document
/documentsCreates a new dispute evidence document record with status created. Then upload the file with POST /documents/{document_id}/upload; the upload body must be exactly content_length bytes.
Headers
AuthorizationstringRequiredidempotency-keystringA unique key, such as a UUID, that makes a POST or DELETE request safe to retry. Pay.com keeps each key for 24 hours, separately for each workspace.
- A retry with the same key, endpoint and body gets the first request's stored status and body, without running the request again.
- If the first request is still being processed, a retry gets 409
idempotency_error(request_in_progress). - The same key on another endpoint, or with another body, gets 400
idempotency_error(invalid_parameters). - GET, PUT and PATCH requests ignore the key.
The response repeats the key in its Idempotency-Key header.
Parameters
filenamestringRequiredThe original filename of the document.
referencestringRequiredA reference identifier to associate with the document.
content_typestringRequiredThe MIME type of the document. The Content-Type header of the upload request replaces it.
content_lengthintegerRequiredThe size of the document in bytes. The uploaded file must be exactly this size.
titlestringA display title for the document. Defaults to filename.
Returns
Returns the created document object.
idstringRequiredUnique identifier for the document.
resourcestringRequiredString representing the object's type.
createdstringRequiredTime at which the object was created, in ISO 8601 format.
filenamestringRequiredThe original filename of the uploaded document.
referencestringRequiredA reference identifier for the document.
statusstringRequiredStatus of the document. One of created (no file uploaded yet), pending (uploaded and being scanned), active (accepted; contents can be downloaded and the document can be used as evidence), or rejected.
content_typestringRequiredThe MIME type of the document.
content_lengthintegerThe size of the document in bytes.
categorystringRequiredThe category of the document.
urlstringThe absolute URL to retrieve the document contents.
titlestringThe display title of the document. Defaults to filename.
Errors
400401invalid_key, invalid_token, legacy_keys_ended, legacy_keys_off or permission_denied).403resource_not_allowed, key_disabled, network_not_allowed, pci_required or merchant_required), or this resource isn't enabled for your account (permission_denied). code says why.409idempotency-key is still being processed (request_in_progress). Wait, then retry with the same key.500503Retry-After, or after a few seconds when there's none.