API ReferenceDocuments

Begin a document upload

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

Starts an upload on an existing deal package, or reuses its pending upload. No Idempotency-Key is required. Returns 201 when a new pending document row is created and 200 when an existing awaiting_upload row is reused with a freshly minted signed URL.

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

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

NameTypeDescription
dealId
required
string
Formatuuid
packageId
required
string
Formatuuid
file
required
object
name
required
string
Length1 <= length <= 255
size
required
integer
Range0 < value <= 52428800
contentType
required
"application/pdf"
sha256string
Pattern^[a-f0-9]{64}$

Response Body

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" \  -H "Content-Type: application/json" \  -d '{    "dealId": "f480fdfe-5c44-458b-b537-f3d9f40f9678",    "packageId": "471cc1d4-ec27-4504-b7c2-949af95662bc",    "file": {      "name": "string",      "size": 1,      "contentType": "application/pdf"    }  }'
{
  "documentId": "4704590c-004e-410d-adf7-acb7ca0a7052",
  "flowId": "ccd52024-9c9c-4751-993a-9d75a778bf9d",
  "fileName": "string",
  "uploadUrl": "http://example.com",
  "expiresAt": "2019-08-24T14:15:22Z"
}
{
  "documentId": "4704590c-004e-410d-adf7-acb7ca0a7052",
  "flowId": "ccd52024-9c9c-4751-993a-9d75a778bf9d",
  "fileName": "string",
  "uploadUrl": "http://example.com",
  "expiresAt": "2019-08-24T14:15:22Z"
}
{
  "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": {}
  }
}