Skip to navigation

Upload a document (multipart)

Upload path 1 of 3: send the file as multipart/form-data.

Accepted categories: insurance, license, background_check, training_cert, tax_form, agreement, endorsement, workers_compensation_exemption, safety_policy (business_registration, notice_of_cancellation and certificate are rejected with 400).

Other documents (W-9, OSHA card, First Aid, …). Every category but insurance, endorsement, license and background_check is read by AI, which checks the file really is that kind of document and reads who it is issued to, its dates and its key fields (a W-9’s TIN is kept as its last 4 digits only). Name the kind in documentType (see DocumentType). It is required for training_cert (osha_card, first_aid_cpr, lift_safety) and defaults for the rest. license and background_check files are stored only: kept on file, never read by AI, and the document stays lifecycleStatus: uploaded. Licenses are checked against state records by a license report requirement (reportSource: tradesapi_license); background checks will run through the background check API. For a background_check file, documentType may be left out; the former values level_2_screening and background_check are still accepted and kept as a label. A new document replaces the active one of the same kind only, so an OSHA card and a First Aid card can both be on file. A document that doesn’t look like the kind it was uploaded as, or that the AI reads with low confidence, is held for TradeGuard review instead of counting. Use endorsement for endorsement pages sent separately from the certificate (CG 20 10, CG 24 04, IL 80 01 and so on): they are read like pages attached to a certificate, count toward the subcontractor’s endorsement and notice-of-cancellation requirements alongside its certificate, and those requirements are re-checked once the file is read. Allowed file types: application/pdf, image/png, image/jpeg, image/jpg, image/webp, image/heic, image/heif, image/tiff; at most 25 MiB; not empty. The file’s contents must match its declared type (a PDF must start with %PDF-, a PNG with the PNG signature, and so on), or the upload is rejected with 400. A file containing the EICAR anti-malware test string is rejected with 422. The file name is kept on the document as sent but is reduced to safe characters in the storage key.

By default the document becomes active, and the validation + extraction workflow starts in the background — the response does not wait for it. A document.uploaded event is published on the organization’s event stream.

The document replaces (superseded) the earlier active document of the same category for this subcontractor and organization only once it has been read: validation and extraction passed (for a certificate, when its coverage is written; a certificate held for review replaces it once the review approves it). An upload that fails validation or extraction never replaces anything: when another document of its category is active it becomes inactive, and the earlier document stays the one judged. Until then both documents are active. A replaced document’s open review is closed: its pending review is dismissed, the coverages it held for review become inactive, and its coverage_flag issue closes with the reason “Replaced by a newer document”. license and background_check files are never read, so they replace the earlier one right away.

Send activate=false to stage the document instead: it is stored as inactive, nothing is superseded and no validation or extraction runs (activating it later does not start one either — use Extract).

Bytes identical to a document already on file for this subcontractor under your organization (in any status, including a staged one) return 200 with the existing document and duplicate: true, and create nothing. There is no option to upload the same bytes twice; to re-process the existing document, call Extract. One exception: if that document had been read and was later replaced by uploads that couldn’t be read (no newer document of its category has been read since), it becomes active again, those unread uploads become inactive, its requirements are re-checked, and the response also carries restored: true. Another: if the existing document’s last read failed (lifecycleStatus validation_failed or extraction_failed), the re-upload starts reading it again, the same as Extract (and counted against the same re-extraction limit), and the response also carries rereading: true.

Project certificates. Send projectId (or your own job number as projectExternalId) to file the upload as the subcontractor’s project-specific COI for that project instead of a baseline document. It must be an insurance certificate and the subcontractor must have a live assignment on the project (409 otherwise). The document is created with scope: project and filed to the assignment’s project_coi slot, returned as projectDocument (status received_pending_review). A project certificate is evidence for that job only: it never becomes the subcontractor’s baseline coverage, never supersedes the baseline COI and is never sent to the broker for verification. Duplicate detection is per project.

Requires scope documents:write.

Authentication

AuthorizationBearer

Session JWT or API key (ak_...)

Path parameters

subcontractorIdstringRequiredformat: "uuid"

Request

This endpoint expects a multipart form containing a file.
filefileRequired
The file to upload
documentCategoryenumRequired

Accepted categories: insurance, license, background_check, training_cert, tax_form, agreement, endorsement, workers_compensation_exemption, safety_policy (business_registration, notice_of_cancellation and certificate are rejected with 400).

documentTypeenumOptional

The kind of a non-insurance document, within its category:

  • tax_form: w9
  • workers_compensation_exemption: wc_exemption
  • training_cert: osha_card, first_aid_cpr, lift_safety (required)
  • safety_policy: safety_policy
  • agreement: agreement

Stored on the document as metadata.documentType. A type from another category, or one sent with insurance, endorsement or license, is a 400. license and background_check documents are stored only and have no type; a background_check upload still accepts the former values level_2_screening and background_check as a label.

documentLabelstringOptional
metadatastringOptional

JSON object of at most 16 KB, as a string (400 if it is not valid JSON, not an object, or too large).

activateenumOptionalDefaults to true

Only the exact string "false" stages the document (status: inactive, no processing).

Allowed values:
projectIdstringOptionalformat: "uuid"

File this certificate to the subcontractor’s assignment on this project (a project-specific COI). Not with projectExternalId.

projectExternalIdstringOptional

Same as projectId, identifying the project by its externalId (your job number).

submittedByEmailstringOptionalformat: "email"

The email address that sent you this document, when it came from someone else (for example the broker who emailed it to you). When it is the subcontractor’s broker on file, its policies count as verified by the broker (verifiedBy: broker_sent_coi) and no verification call is placed. An address that isn’t on file yet (including one that only matches the producer printed on this certificate) goes to TradeGuard staff to confirm.

Response

Byte-identical document already on file; nothing created

dataobject
messagestring

Errors

400
Bad Request Error
401
Unauthorized Error
403
Forbidden Error
404
Not Found Error
409
Conflict Error
413
Content Too Large Error
422
Unprocessable Entity Error
429
Too Many Requests Error
500
Internal Server Error