create-contract
dci create-contract <customerID> [body]
Creates a draft contract for the specified customer. Requires the caller to be the direct parent (T1 for a T2-level contract, T2 for a T3-level contract). Write access requires a role without contractsReadOnly; user API tokens must include the matching permission in their scope.
customerID— The customer (tenant) the contract is created for.
Pass the request body as name: value arguments or pipe JSON on stdin — see Command structure.
Examples
# Create a draft contract from a JSON file; activate it with `dci activate-contract`.
dci create-contract <customer-id> < contract.json
# contract.json
{"name": "Acme AWS resale FY27", "renewalPolicy": "auto",
"startDate": "2026-10-01T00:00:00Z", "endDate": "2027-09-30T00:00:00Z",
"doitInvoicingEnabled": true,
"invoicesEmail": "[email protected]", "contractUpdatesEmail": "[email protected]"}
# The minimum inline body — name, renewal policy, and start date.
dci create-contract <customer-id> name: "Acme AWS resale FY27", renewalPolicy: manual, startDate: "2026-10-01T00:00:00Z"
# Keep the new `contractId` for the activate step, for scripts.
dci create-contract <customer-id> --fields contractId,status --output json < contract.json
Request
Content-Type: application/json
| Field | Type | Required | Description |
|---|---|---|---|
templateId | string | ID of a contract template owned by the authenticated tenant. When specified, the template's billing rules, price books, and custom line items are copied onto the new contract. Mutually exclusive with billingRules, priceBooks, and customLineItems in the request body. | |
name | string | yes | |
startDate | string (date-time) | yes | |
endDate | string (date-time) | ||
renewalPolicy | string | yes | One of: "auto", "manual", "fixed". |
doitInvoicingEnabled | boolean | Whether DoiT generates invoices for this contract. Disabling suppresses invoice generation from that point forward while billing calculations and pipeline outputs continue. Omitting the field leaves invoicing enabled. Default: true. | |
invoicesEmail | string (email) | Required for an end-customer contract with doitInvoicingEnabled set to true; optional otherwise. | |
contractUpdatesEmail | string (email) | Required for an end-customer contract with doitInvoicingEnabled set to true; optional otherwise. | |
billingProfile | object | The billing profile (name, country, state, city, address, zip). Required for an end-customer contract with doitInvoicingEnabled set to true; optional otherwise. | |
managementAccounts | array of string | ||
billingRules | array of object | ||
priceBooks | array of object | ||
customLineItems | array of object |
Raw JSON schema
{
"allOf": [
{
"type": "object",
"description": "Contract create/update payload. Full field-level validation is applied server-side.",
"required": [
"name",
"startDate",
"renewalPolicy"
],
"properties": {
"name": {
"type": "string"
},
"startDate": {
"type": "string",
"format": "date-time"
},
"endDate": {
"type": "string",
"format": "date-time",
"nullable": true
},
"renewalPolicy": {
"type": "string",
"enum": [
"auto",
"manual",
"fixed"
]
},
"doitInvoicingEnabled": {
"type": "boolean",
"default": true,
"description": "Whether DoiT generates invoices for this contract. Disabling suppresses invoice generation from that point forward while billing calculations and pipeline outputs continue. Omitting the field leaves invoicing enabled."
},
"invoicesEmail": {
"type": "string",
"format": "email",
"description": "Required for an end-customer contract with doitInvoicingEnabled set to true; optional otherwise."
},
"contractUpdatesEmail": {
"type": "string",
"format": "email",
"description": "Required for an end-customer contract with doitInvoicingEnabled set to true; optional otherwise."
},
"billingProfile": {
"type": "object",
"description": "The billing profile (name, country, state, city, address, zip). Required for an end-customer contract with doitInvoicingEnabled set to true; optional otherwise."
},
"managementAccounts": {
"type": "array",
"items": {
"type": "string"
}
},
"billingRules": {
"type": "array",
"items": {
"type": "object"
}
},
"priceBooks": {
"type": "array",
"items": {
"type": "object"
}
},
"customLineItems": {
"type": "array",
"items": {
"type": "object"
}
}
}
},
{
"type": "object",
"properties": {
"templateId": {
"type": "string",
"description": "ID of a contract template owned by the authenticated tenant. When specified, the template's billing rules, price books, and custom line items are copied onto the new contract. Mutually exclusive with billingRules, priceBooks, and customLineItems in the request body."
}
}
}
]
}
Output
Created - The contract draft was created.
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 |
|---|---|---|
contractId | string | |
version | integer | |
status | string | |
message | string | |
timestamp | string (date-time) |
Raw JSON schema
{
"type": "object",
"description": "The result of creating a contract or contract version.",
"properties": {
"contractId": {
"type": "string"
},
"version": {
"type": "integer"
},
"status": {
"type": "string"
},
"message": {
"type": "string"
},
"timestamp": {
"type": "string",
"format": "date-time"
}
}
}
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. |
Related
- activate-contract — Activate contract
- get-contract — Retrieve a contract
- list-contracts — List contracts
- update-contract — Update contract
- cancel-contract — Cancel contract
- API reference: POST /customers/{customerID}/contracts
Aliases: createcontract