Home
Home
  1. Documents
  • Getting started
  • Authentication
  • Webhooks
  • Embeddable widgets
    • Overview
    • Document upload widget
      • Designing an upload flow
  • Guides
    • Verifying a new business
    • Verifying bank accounts
    • Uploading documents
    • Country-specific fields
    • Supported document types
  • API reference
    • Submissions
      • Reports
        • List available report templates
        • Download a report
      • Create new submission
      • Get submission
      • Update submission
      • Update submission status
      • Run a submission pre-flight check
      • Run business verification
      • Get submission checks
      • Delete submission
      • List submissions
    • Documents
      • Public documents API
        • List documents (public)
        • Upload document (public)
        • Get document (public)
        • Delete document (public)
        • Download document file (public)
        • Rerun validations (public)
      • List documents
        GET
      • Upload document
        POST
      • Get document
        GET
      • Delete document
        DELETE
      • Download document file
        GET
      • Rerun validations
        PUT
    • RPC search
      • RPC search
      • Get company with ID
      • Look up company by RFC
      • Search companies by name
      • Download RPC document
    • Utilities
      • Matcher
        • Run name matching
  1. Documents

Upload document

Production
https://api.niva.co/v1
Production
https://api.niva.co/v1
POST
https://api.niva.co/v1
/submissions/{id}/documents
Uploads one document to the submission and validates it before responding.

Identify the document#

Send country_code, document_type and document_subtype (the subtype may be omitted for photo_identification and address_proof, where Niva detects it). The pairs each market accepts are listed under Supported document types; country_code must be the submission's market, except a Mexican photo_identification, which takes the issuing country (e.g. us for a US passport). An other / other document also needs document_name.
Send the file as file, or several files of the same document as files (Niva merges them into one PDF); exactly one of the two. PDF, JPG and PNG are accepted, up to 100 MB in total.
TIP
Send only the fields you need: a blank field counts as sent.

Document validation#

Niva checks every document except other for legibility, completeness and type before responding, so the response carries the result in validation_status, validation_errors and the extracted data. A document that fails a blocking check is still returned with 201. With persist_invalid=false, Niva archives a document that fails a blocking check and sends document.deleted; the response still contains that document. If validation takes longer than about 100 seconds the request fails with 500, but the document is kept and validation continues: do not upload it again. Wait for the document.validated webhook or find the document with List documents by external_id.

Custom validation inputs#

Name checks compare the name on the document with the business or applicant on the submission. To compare against a different name, send validation_inputs[name]; to require the holder to be a person or a company, send validation_inputs[entity_type]. Both only affect the checks your policy runs at upload, by default name checks on Mexican proof of address, bank statements, CSF (Constancia de Situación Fiscal) and INE (voter ID), and on ID documents, tax registrations and bank statements in Brazil, Chile and Colombia.

Merging#

If corporate-document merging is enabled for your account, a Mexican deed may be combined with matching deeds; the uploaded child is returned with parent_document_id. When complementary ID sides are combined, the response instead contains the combined document. Always use the id returned by the upload response. See Merging documents.

Errors#

422 responseWhen
document_subtype: is not supported for <market> "<type>" documentsThe pair is not in the market's list
country_code: must match the submission's marketA non-Mexican document with another market's code
document_name: is requiredAn other document without a name
file, files: are missing, exactly one parameter must be providedNeither file nor files was sent
Invalid file type / File is too large. Maximum allowed 100MBFile rules
Validation errors use errors, an array of strings or {field, message} objects. Unsupported file formats and oversized files instead return a single error string; see the response examples.

Request

Authorization
Add parameter in header
apiKey
Example:
apiKey: ********************
Path Params

Header Params

Body Params multipart/form-data

Request Code Samples

Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
Request Request Example
Shell
JavaScript
Java
Swift
curl --location 'https://api.niva.co/v1/submissions/sub_3ZMd9KJnvAdYt4mOyW7YQRAp/documents' \
--header 'Accept-Language: en' \
--header 'apiKey: <api-key>' \
--form 'document_type="formation"' \
--form 'document_subtype="acta_constitutiva"' \
--form 'country_code="mx"' \
--form 'file=@"acta_constitutiva.pdf"'

Responses

🟢201Created
application/json
Success
Bodyapplication/json

Examples
{
  "id": "doc_MAXm5v0B7kZVHorQL8YjV2y9",
  "submission_id": "sub_3ZMd9KJnvAdYt4mOyW7YQRAp",
  "validation_status": "valid",
  "country_code": "mx",
  "document_type": "formation",
  "document_subtype": "acta_constitutiva",
  "uploaded_at": "2026-10-23T21:31:32.588Z",
  "validation_errors": [],
  "source": "user",
  "external_id": "acta-001",
  "document_name": null,
  "file": {
    "name": "acta_constitutiva.pdf",
    "byte_size": 482113
  },
  "data": {
    "business": {
      "entity_type": null,
      "legal_name": "Nueva Vista Alimentos S.A. de C.V.",
      "previous_legal_names": [],
      "merged_company_legal_names": [],
      "incorporation_date": null
    },
    "document": {
      "document_type": "acta_constitutiva",
      "date_of_deed": "2012-04-09",
      "boleta": {
        "is_present": true,
        "entry_number": "N-2012012345"
      }
    },
    "officers": null
  },
  "parent_document_id": null,
  "merged_documents": []
}
🟠401Unauthorized
🟠404Not Found
🟠422Unprocessable Content
🔴500Internal Server Error
Previous
List documents
Next
Get document