Add templates to a package

POST
/api/v1/orgs/{orgId}/deals/{dealId}/packages/{packageId}/templates

Merges the document flows of one or more deal templates (from listDeals with isTemplate=true) into an existing package. Requires the api_deals_create scope and the bound user's edit access to the deal. Idempotency-Key is required and enforced server-side for safe retries.

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

dealId
required
string

Deal ID that owns the package

Formatuuid
packageId
required
string

Package ID

Formatuuid

Header Parameters

NameTypeDescription
Idempotency-Key
required
string

Required client-supplied idempotency key for safe add-templates retries

Length1 <= length

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

NameTypeDescription
templateDealIds
required
array<string>

Template dealIds from list_deals with isTemplate=true. One id copies the template; several merge their documents.

Items1 <= items <= 10

Response Body

application/json

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/deals/550e8400-e29b-41d4-a716-446655440010/packages/550e8400-e29b-41d4-a716-446655440011/templates" \  -H "Idempotency-Key: 550e8400-e29b-41d4-a716-446655440000" \  -H "Content-Type: application/json" \  -d '{    "templateDealIds": [      "497f6eca-6276-4993-bfeb-53cbbbba6f08"    ]  }'
{
  "dealId": "f480fdfe-5c44-458b-b537-f3d9f40f9678",
  "packageId": "471cc1d4-ec27-4504-b7c2-949af95662bc"
}
{
  "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": {}
  }
}
{
  "error": {
    "code": "ERROR_CODE",
    "message": "Human-readable error message",
    "details": {}
  }
}