Contract End Date (Contracts)
Contracts
Read, create, update, and delete contracts and subscriptions with attributes, domains, status history, and linked invoices. A separate sub-endpoint changes the status.
GET /Export/JSON/contracts
GET /Export/JSON/contract/{id}
POST /Import/JSON/contracts
PUT /Import/JSON/contracts
PUT /Import/JSON/contracts/{id}/status
DELETE /Delete/JSON/contract/{id}Endpoints
| Method | Endpoint | Scope | Description |
|---|---|---|---|
| GET | /Export/JSON/contracts | contracts:read | All contracts, in ascending order of ID (with filters) |
| GET | /Export/JSON/contract/{id} | contracts:read | A single contract; without a match, HTTP 200 with an empty data |
| GET | /Export/JSON/contracts/{von}:{bis}, /contracts/{von}: | contracts:read | ID range or open range |
| GET | /Export/JSON/contracts/{id} | contracts:read | ⚠️ Plural: all contracts from this ID onward, not just one |
| POST | /Import/JSON/contracts | contracts:write | Create new contracts |
| PUT | /Import/JSON/contracts | contracts:write | Update existing contracts |
| PUT | /Import/JSON/contracts/{id}/status | contracts:write | Change only the status, with an entry in the status history |
| DELETE | /Delete/JSON/contract/{id} | contracts:delete | Delete a contract, including its attributes, domains, and status history |
| DELETE | /Delete/JSON/contracts | contracts:delete | Multiple contracts via JSON body {"data": [{"contracts_id": …}]} |
/contracts/{von}:{bis}. Up to v2.122.11, /contracts/10/20 silently returned the contracts from 10 onward without an upper bound; it now returns HTTP 400 INVALID_RANGE, as does any other segment that is neither an integer nor a range (/contract/10x, /contract/10.0). Leading/trailing whitespace around the ID is ignored. Rules: Export API, section “Path segment”.Query filter (GET)
| Parameter | Description | Example |
|---|---|---|
?status= | ID of a contract status; the shop’s statuses are listed in contracts_statuses[] of every response | ?status=1 |
?customer_id= | Customer ID | ?customer_id=42 |
?product_id= | Product ID | ?product_id=100 |
?interval= | Billings per year: 1 annually, 2 semi-annually, 3 three times a year, 4 quarterly, 6 six times a year, 12 monthly | ?interval=12 |
?date_from=, ?date_to= | Contract date (contracts_date) from or to | ?date_from=2025-01-01 |
?active=1 | only contracts without a recorded cancellation date (contracts_cancellation_date_effective empty); a future cancellation date also excludes the contract | ?active=1 |
Multiple filters are combined. An unusable value returns HTTP 400 INVALID_FILTER_VALUE, for example ?interval=5 (since v2.122.10). Since v2.122.12, leading/trailing whitespace is ignored, and an empty value means “not set”.
Data Structure
Every contract carries these fields. Status and item names are returned in German.
| Group | Fields |
|---|---|
| Identifier and status | contracts_id, contracts_status_id, contracts_status_name |
| Customer | contracts_customers_id, customer_name, customer_email, contracts_customers_address_book_id, contracts_shipping_address_book_id |
| Item and price | contracts_products_id, product_name, product_model, contracts_products_quantity, contracts_products_tax, contracts_price, contracts_final_price, contracts_discount, contracts_use_current_price |
| Billing | contracts_interval and contracts_period_interval (values as for ?interval=, each with an additional field …_text containing the label), contracts_months, contracts_next_order_date, contracts_payment_class |
| Periods | contracts_date; term contracts_current_term_date_begin/_end, billing period contracts_current_period_date_begin/_end, last billed contracts_last_billed_term_date_begin/_end and contracts_last_billed_period_date_begin/_end |
| Cancellation | contracts_cancellation_date_received, contracts_cancellation_date_effective |
| Domain and license | contracts_domain_id, contracts_domain_name, contracts_overwrite_domain, contracts_xolic_id |
| Miscellaneous | contracts_comment, contracts_template, contracts_error_flag, contracts_is_standalone |
Nested data
| List | Content per entry |
|---|---|
attributes[] | Attributes of the contract item: contracts_products_attributes_id, contracts_products_id, products_options, products_options_values, options_values_price, detail_id |
domains[] | contracts_domains_id, contracts_domains_domain_name, contracts_domains_date_paid, contracts_domains_date_termination, contracts_domains_provider, contracts_domains_exclusive, contracts_domains_cost |
status_history[] | newest first: status_history_id, status_id, status_name, date_added, customer_notified, comments, user_id |
orders[] | linked invoices, most recent link first: orders_id, date_created, date_purchased, orders_status |
Alongside data, every response contains contracts_statuses[] with the shop’s contract statuses that have a German name (status_id, status_name, status_label, status_active, status_is_default).
Import (POST/PUT)
POSTcreates and requirescontracts_customers_idandcontracts_products_idof an existing customer or item. Acontracts_idsent along that already exists makes the record fail.PUTupdates and requires thecontracts_idof an existing contract. Only the fields sent are written.- The fields of the data structure are writable except the names and texts (
contracts_status_name,customer_name,customer_email,product_name,product_model,contracts_domain_name,…_text). If you send an export back, the import reports these as unknown fields (UNKNOWN_FIELD), as well as the listsstatus_history[]andorders[]and the identifierscontracts_products_attributes_idandcontracts_products_idinattributes[]andcontracts_domains_idindomains[]. The import skips them and writes the remaining fields; remove these fields before sending the data back, and the response contains no warnings. Date fields asYYYY-MM-DD, the billing period fields (…_period_date_…) asYYYY-MM-DD HH:MM:SS;nullor empty clears them. contracts_intervalaccepts only1,2,3,4,6, or12; otherwise, the record fails.attributes[]acceptsproducts_options,products_options_values,options_values_price, anddetail_id,domains[]the keyscontracts_domains_…withoutcontracts_domains_id. WithPUT, a list sent along replaces all previous entries.statusas an object{"status_id": …, "comments": "…", "customer_notified": 0}sets the status and writes an entry to the status history. v2.122.13 Ifstatus_idis not a contract status of the shop (section “Contract status” below), not an integer, or missing, the import writes the record without the status and reports the warningCONTRACT_STATUS_UNKNOWN; the record counts as created or updated.contracts_status_iddirectly on the contract sets the status without an entry in the status history. v2.122.13 A value that is not a contract status is not written, but the other fields are, with the same warning. For a status change with history, usestatusor the sub-endpoint/status.- ⚠️ A set
contracts_cancellation_date_effectivecan take effect at the next run of the automatic contract termination.
Example
curl -s -X POST "https://shop.de/xpanel/xoport/Import/JSON/contracts" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"type": "contracts",
"data": [{
"contracts_customers_id": 42,
"contracts_products_id": 100,
"contracts_interval": 12,
"contracts_price": "29.90",
"contracts_date": "2026-11-01",
"attributes": [
{"products_options": "Lizenztyp", "products_options_values": "Enterprise"}
],
"domains": [
{"contracts_domains_domain_name": "kunde.de"}
],
"status": {"status_id": 1, "comments": "Angelegt per API"}
}]
}'Change status (PUT)
PUT /Import/JSON/contracts/{id}/status with the scope contracts:write. status_id is required, comments and customer_notified are optional. Without status_id the response is HTTP 400 MISSING_FIELD, for a status_id that is not a contract status of the shop or not an integer HTTP 400 INVALID_STATUS with the valid IDs in error.valid_status_ids (since v2.122.13, section “Contract status”), and for an unknown contract HTTP 404 NOT_FOUND. In all three cases, the contract remains unchanged.
curl -s -X PUT "https://shop.de/xpanel/xoport/Import/JSON/contracts/1/status" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"status_id": 3, "comments": "Kündigung per API", "customer_notified": 0}'
# Response
{
"success": true,
"type": "contracts_status",
"contracts_id": 1,
"previous_status_id": 1,
"new_status_id": 3,
…
}If the contract has an effective cancellation date, the response also contains warning: the automatic contract termination can overwrite the status later.
Contract status v2.122.13
Every contract status of the shop is valid for status_id, status.status_id and contracts_status_id: the statuses of the table status with type = 'contracts', which the backend also reads, in every language, including deactivated ones (status_active = 0); these are only hidden from the selection in the backend. Order statuses (/order_statuses) are not contract statuses. Which IDs apply differs from shop to shop: read them from contracts_statuses[] of GET /Export/JSON/contracts or from error.valid_status_ids. contracts_statuses[] lists only the statuses with a German name; a status without a German name is still valid.
The ID is an integer, as a number or as a string of digits (54, "54"; leading or trailing whitespace does not count). true, [65], "54abc", "1e3", 54.9 or 54.0 are not IDs.
| Write path | No valid contract status |
|---|---|
PUT /Import/JSON/contracts/{id}/status | HTTP 400 INVALID_STATUS, error.valid_status_ids lists the valid IDs; the contract remains unchanged |
Contract import, status.status_id (also status without status_id, such as "status": 54 or "status": {}) | Record written, status and status history unchanged, warning CONTRACT_STATUS_UNKNOWN with field = status.status_id or status; "status": null counts as not sent |
Contract import, contracts_status_id | Field not written (stays empty on creation), other fields written, warning CONTRACT_STATUS_UNKNOWN with field = contracts_status_id |
HTTP 400
{
"success": false,
"api_version": "2.122.13",
"error": {
"code": "INVALID_STATUS",
"message": "status_id 1 is not a contract status. Valid: 7, 3, 12 (…)",
"valid_status_ids": [7, 3, 12]
}
}In the contract import, the record still counts as inserted or updated. The warning appears in warnings[] of the response and on the record’s entry in records[]:
"warnings": [
{
"type": "CONTRACT_STATUS_UNKNOWN",
"field": "status.status_id",
"entity": "contracts",
"contracts_id": 42,
"message": "Contract 42: status.status_id ignored — status.status_id 1 is not a contract status. Valid: 7, 3, 12 (…)",
"first_occurrence": "record 1"
}
]/status and the object status checked against the order statuses (orders_status). A contract status that did not also exist as an order status resulted in HTTP 400 at the sub-endpoint and was silently skipped in the import; an ID that existed only as an order status was written as a contract status, at the sub-endpoint with the name of the order status in new_status_name. contracts_status_id was written unchecked ("abc" as 0, true as 1), and values such as "1e3" or 54.9 counted as 1000 and 54 respectively. ⚠️ If you send order status IDs as contract statuses, you now get HTTP 400 or the warning: use the IDs from contracts_statuses[]. new_status_name now contains the name of the contract status.Delete (DELETE)
This deletes the contract, its attributes and domains, its status history, and its links to invoices and projects. The invoices and projects themselves are kept.
orders[] of GET /Export/JSON/contract/{id}, each with its order status orders_status. Whether a status counts as paid is shown by is_paid in GET /Export/JSON/order_statuses (Orders, section “Order Status Master Data”).# One contract
curl -s -X DELETE "https://shop.de/xpanel/xoport/Delete/JSON/contract/1" \
-H "Authorization: Bearer $TOKEN"
# Multiple contracts
curl -s -X DELETE "https://shop.de/xpanel/xoport/Delete/JSON/contracts" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"data": [{"contracts_id": 1}, {"contracts_id": 2}]}'- For a single-record call, an unknown contract returns HTTP 404
NOT_FOUND. In a batch, deleted IDs are listed indeleted_ids, IDs not found inerrors[]. - A body without
data[].contracts_id, for example{"ids": [1, 2]}, deletes nothing and returns HTTP 400MISSING_DATA.
OAuth2 scopes
| Scope | Permission |
|---|---|
contracts:read | Read contracts |
contracts:write | Create and update contracts, including the status |
contracts:delete | Delete contracts |