assign-contract-template
dci assign-contract-template <templateID> [body]
Applies a contract template owned by the authenticated tenant (from the bearer token) to child customers, creating a draft contract for each. Drafts have no billing effect until each one is completed and activated. The template must not be archived, and the current date must fall within its eligibility window. Requires ContractTemplatesAdmin, DoiT API access (platform:externalApi), and the channelops:contracts:templates entitlement.
templateID— Identifier of the contract template to apply.
Pass the request body as name: value arguments or pipe JSON on stdin — see Command structure.
Request
Content-Type: application/json
| Field | Type | Required | Description |
|---|---|---|---|
customerIds | array of string | yes | Identifiers of the customers to create a draft contract for. Each identifier must name a tenant within the authenticated tenant's own hierarchy, of the tier one level below it: a distributor supplies resellers, a reseller supplies end customers. Repeated identifiers are ignored, and a customer already holding a contract from this template receives another draft. |
Raw JSON schema
{
"type": "object",
"description": "The customers a contract template is applied to.",
"required": [
"customerIds"
],
"properties": {
"customerIds": {
"type": "array",
"description": "Identifiers of the customers to create a draft contract for. Each identifier must name a tenant within the authenticated tenant's own hierarchy, of the tier one level below it: a distributor supplies resellers, a reseller supplies end customers. Repeated identifiers are ignored, and a customer already holding a contract from this template receives another draft.",
"minItems": 1,
"maxItems": 250,
"items": {
"type": "string"
}
}
}
}
Output
Created - Draft contracts created for the specified customers.
By default dci renders the result as a table. Use --output json to get the full structure described below — see Output formats.
| Field | Type | Description |
|---|---|---|
count | integer | Number of draft contracts created. |
createdContracts | array of object | One entry per created draft contract, in the order the customers were supplied. |
createdContracts[].customerId | string | Identifier of the customer the draft contract was created for. |
createdContracts[].contractId | string | Identifier of the created draft contract. |
Raw JSON schema
{
"type": "object",
"description": "The draft contracts created by applying a contract template.",
"properties": {
"count": {
"type": "integer",
"description": "Number of draft contracts created."
},
"createdContracts": {
"type": "array",
"description": "One entry per created draft contract, in the order the customers were supplied.",
"items": {
"type": "object",
"description": "A draft contract created from a contract template.",
"properties": {
"customerId": {
"type": "string",
"description": "Identifier of the customer the draft contract was created for."
},
"contractId": {
"type": "string",
"description": "Identifier of the created draft contract."
}
}
}
}
}
}
Errors
On failure, dci prints a single error message — with a hint when one is available — and exits with a typed code your scripts can branch on. See Errors and exit codes for the full contract.
HTTP status to exit code mapping
| HTTP status | Exit code | Error code | Meaning |
|---|---|---|---|
| 400 | 30 | VALIDATION_ERROR | The arguments or request body were rejected. Review the command's flags and payload. |
| 401 | 10 | AUTHENTICATION_FAILED | Not signed in, or the API token is invalid. Run dci login or check DCI_API_KEY. |
| 403 | 11 | PERMISSION_DENIED | The DoiT user or the active customer context does not have access. |
| 404 | 20 | RESOURCE_NOT_FOUND | The requested resource does not exist. Check the identifier argument. |
| 409 | 21 | RESOURCE_CONFLICT | The operation conflicts with the resource's current state. |
| 500 | 40 | API_SERVER_ERROR | The API failed to process the request. Retryable; contact DoiT support if it persists. |
Related
- archive-contract-template — Archive contract template
- create-contract-template — Create contract template
- get-contract-template — Get contract template
- list-contract-templates — List contract templates
- update-contract-template — Update contract template
- API reference: POST /billing/v1/contract-templates/{templateID}/actions/assign
Aliases: assigncontracttemplate