API ReferenceDocuments

Complete a staged document upload

POST
/api/v1/orgs/{orgId}/document-uploads/{documentId}/complete

Accepts a PDF previously PUT to the signed uploadUrl from create-deal and enqueues document processing. Idempotency-Key is required and enforced server-side for safe retries. When object storage reports a file size, uploads over the limit return 413 with error code UPLOAD_ERROR; if size metadata is unavailable the check is skipped. When the pending document recorded a declared size and storage reports a size, a different size returns 409 UPLOAD_MISMATCH and the upload is not claimed. When the pending document recorded a sha256, the staged bytes are hashed and must match that digest before the upload is claimed. The object is not downloaded when no sha256 was declared.

Requires the api_deals_create scope.

Authorization

bearerAuth
AuthorizationBearer <token>

Bearer token using a Clai API key secret (clai_live_*).

In: header

Path Parameters

NameTypeDescription
orgId
required
string

Organization ID the key is operating in

documentId
required
string

Staged document ID returned from create-deal

Formatuuid

Header Parameters

NameTypeDescription
Idempotency-Key
required
string

Required client-supplied idempotency key for safe complete-upload retries

Length1 <= length

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

NameTypeDescription
body
required
object

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://app.goclai.com/api/v1/orgs/org_2abc123/document-uploads/550e8400-e29b-41d4-a716-446655440000/complete" \  -H "Idempotency-Key: 550e8400-e29b-41d4-a716-446655440001" \  -H "Content-Type: application/json" \  -d '{}'
{
  "documentId": "4704590c-004e-410d-adf7-acb7ca0a7052",
  "flowId": "ccd52024-9c9c-4751-993a-9d75a778bf9d",
  "collectionId": "string",
  "status": "awaiting_upload",
  "updatedAt": "2019-08-24T14:15:22Z",
  "pollAfterMs": 2000,
  "error": "invalid_pdf",
  "errorMessage": "string",
  "detection": {
    "outcome": "detected",
    "participantCount": 0,
    "signatureFieldCount": 0
  },
  "canFindSignatures": true
}
{
  "error": {
    "code": "ERROR_CODE",
    "message": "Human-readable error message",
    "details": {}
  }
}
{
  "error": {
    "code": "ERROR_CODE",
    "message": "Human-readable error message",
    "details": {}
  }
}
{
  "error": {
    "code": "ERROR_CODE",
    "message": "Human-readable error message",
    "details": {}
  }
}
{
  "error": {
    "code": "ERROR_CODE",
    "message": "Human-readable error message",
    "details": {}
  }
}
{
  "error": {
    "code": "ERROR_CODE",
    "message": "Human-readable error message",
    "details": {}
  }
}
{
  "error": {
    "code": "ERROR_CODE",
    "message": "Human-readable error message",
    "details": {}
  }
}
{
  "error": {
    "code": "ERROR_CODE",
    "message": "Human-readable error message",
    "details": {}
  }
}