Contract End Date (Contracts)

v2.7.0 · CRUD · Contracts & Subscriptions

Contracts

Manage contracts and subscriptions with attributes, domains, status history, and order links. Supports dedicated status updates via sub-endpoints.

GET    /Export/JSON/contracts
POST   /Import/JSON/contracts
PUT    /Import/JSON/contracts
PUT    /Import/JSON/contracts/{id}/status
DELETE /Delete/JSON/contracts/{id}

Endpoints

MethodEndpointScopeDescription
GET/Export/JSON/contractscontracts:readList all contracts (with filters)
GET/Export/JSON/contracts/{id}contracts:readRetrieve a single contract
POST/Import/JSON/contractscontracts:writeCreate a new contract
PUT/Import/JSON/contractscontracts:writeUpdate an existing contract
PUT/Import/JSON/contracts/{id}/statuscontracts:writeChange status only (own scope)
DELETE/Delete/JSON/contracts/{id}contracts:deleteDelete individually by ID (cascading)
DELETE/Delete/JSON/contractscontracts:deleteBulk deletion via JSON body

Query filter (GET)

ParameterDescriptionExample
?status=Contract status (1–7)?status=1 (Active)
?customer_id=Customer ID?customer_id=42
?product_id=Product ID?product_id=100
?interval=Interval (1=Annual, 12=Monthly, …)?interval=12
?date_from=Start date (YYYY-MM-DD)?date_from=2025-01-01
?date_to=End Date (YYYY-MM-DD)?date_to=2025-12-31

Data Structure

Main Fields

FieldTypeDescription
contracts_idINTPrimary key
customers_idINTCustomer ID
products_idINTProduct ID
contracts_statusINTStatus (1=Active, 2=Paused, 3=Terminated, …)
contracts_intervalINTInterval (1=Annual, 2=Semiannual, 4=Quarterly, 12=Monthly)
contracts_priceDECIMALNet amount
contracts_date_addedDATETIMECreation date
contracts_date_startDATEContract start date
contracts_date_endDATEContract end date (NULL = indefinite)
current_period_date_beginDATEStart of the current billing period
current_period_date_endDATEEnd of the current billing period

Nested relations

RelationDescription
attributes[]Contract attributes (key-value pairs)
domains[]Assigned domains
status_history[]Status changes with date and comment
orders[]Linked orders

OAuth2 scopes

ScopePermission
contracts:readRead/export contracts
contracts:writeCreate and update contracts
contracts:deleteDelete contracts
contracts:writeChange a contract's status only

Examples

Export (GET)

curl -s "https://shop.de/xpanel/xoport/Export/JSON/contracts?status=1&interval=12" \
  -H "Authorization: Bearer $TOKEN" | jq '.data[0]'

# Response:{
  "contracts_id": 1,
  "customers_id": 42,
  "products_id": 100,
  "contracts_status": 1,
  "contracts_status_text": "Aktiv",
  "contracts_interval": 12,
  "contracts_interval_text": "Monatlich",
  "contracts_price": "29.90",
  "attributes": [
    {"id": 1, "key": "Lizenztyp", "value": "Enterprise"}],
"domains": [
   {"id": 1, "domain": "kunde.de", "active": 1} ],
"status_history": [...],
"orders": [...]
}

Import (POST)

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": [{
      "customers_id": 42,
      "products_id": 100,
      "contracts_status": 1,
      "contracts_interval": 12,
      "contracts_price": "29.90",
      "attributes": [
        {"key": "Lizenztyp", "value": "Enterprise"}
      ],
      "domains": [
       {"domain": "kunde.de"} 
      ]
    }]
  }'

Status Update (PUT)

# Custom endpoint with a separate scope
curl -s -X PUT "https://shop.de/xpanel/xoport/Import/JSON/contracts/1/status" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"contracts_status": 3, "comment": "Kündigung per API"}'

Cascading Deletion (DELETE)

# Deletes the contract, including attributes, domains, and status history
curl -s -X DELETE "https://shop.de/xpanel/xoport/Delete/JSON/contracts/1" \
  -H "Authorization: Bearer $TOKEN"

# Bulk deletion:
curl -s -X DELETE "https://shop.de/xpanel/xoport/Delete/JSON/contracts" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"ids": [1, 2, 3]}'