Add templates to a package
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 Bearer token using a Clai API key secret (clai_live_*).
In: header
Path Parameters
| Name | Type | Description |
|---|---|---|
orgIdrequired | string | Organization ID the key is operating in |
dealIdrequired | string | Deal ID that owns the package Format uuid |
packageIdrequired | string | Package ID Format uuid |
Header Parameters
| Name | Type | Description |
|---|---|---|
Idempotency-Keyrequired | string | Required client-supplied idempotency key for safe add-templates retries Length 1 <= length |
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
| Name | Type | Description |
|---|---|---|
templateDealIdsrequired | array<string> | Template dealIds from list_deals with isTemplate=true. One id copies the template; several merge their documents. Items 1 <= 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": {}
}
}POSTCreate a deal
Creates a deal in the specified organization for the API key bound user. Send deal fields with name, or templateDealIds alone (from listDeals with isTemplate=true): one id copies the template, several merge their documents into one package. Send isTemplate=true with name to create a reusable template instead of a deal; the template is personal to the bound user, needs a plan that includes templates, and the response adds isTemplate and prepareUrl. isTemplate cannot be combined with templateDealIds. Set sale vs lease and pricing on the deal here (`transactionType`, `amount`, `deposit`, `startDate`, `financingType`); updatePackage only renames a package (`name`). Denied fields such as teamId and templateDealId are rejected before Zod validation. Idempotency-Key is required and enforced server-side for safe retries. Requires the `api_deals_create` scope.
POSTSave a deal as a template
Saves an existing deal as a new template. The template is a separate copy: documents, fields, packages and tasks are copied, signers become role-only slots, and submissions and signer contact details are not copied. The source deal is kept unchanged and later edits to it do not update the template; calling again creates another template. Requires the `api_deals_create` scope, the bound user's edit access to the deal, and a plan that includes templates. Idempotency-Key is required and enforced server-side for safe retries.