Skip to content

Creditor Case Actions

These actions allow a creditor to interact with an active case. They apply to any case, regardless of whether it was created through an Invoice Registration or a Case Registration.

All endpoints operate on the case entity. For payments, creditings, and cancellations you can identify the target case either by providing the case ID directly, or by using invoice_number together with creditor. For respite, the case ID is provided as a URL parameter.

All API requests require a valid authentication token in the X-API-Key header. For details about the authentication process and token management, see the Authentication documentation.

In this guide, we will use the AuthTokenProvider class (documented in the authentication guide) to handle token management.

Table of Contents


Creditor Payment

Register a payment received directly from the debtor using the Creditor Payment endpoint. This is used when the creditor has received a payment outside of Amili's collection process and wants to register it against the case.

typescript
const paymentData = {
  creditor: '674dbeb208847b9501cc9138',
  case: '68e4c40d93ee14723d28fa95',
  amount: 250.0,
  currency: 'SEK',
  bank_transaction_date: new Date().toUTCString(),
  origin: 'creditor_system',
  creditor_payment_reference: 'PAY-REF-001', // optional
}

const token = await auth.getValidToken()
const response = await axios.post(
  'https://api-sandbox.amili.se/creditor--payments',
  paymentData,
  {
    headers: {
      'X-API-Key': token,
      'Content-Type': 'application/json',
    },
  }
)
python
from datetime import datetime

payment_data = {
    "creditor": "674dbeb208847b9501cc9138",
    "case": "68e4c40d93ee14723d28fa95",
    "amount": 250.0,
    "currency": "SEK",
    "bank_transaction_date": datetime.utcnow().strftime("%a, %d %b %Y %H:%M:%S GMT"),
    "origin": "creditor_system",
    "creditor_payment_reference": "PAY-REF-001"  # optional
}

token = auth.get_valid_token()
response = requests.post(
    'https://api-sandbox.amili.se/creditor--payments',
    json=payment_data,
    headers={
        'X-API-Key': token,
        'Content-Type': 'application/json'
    }
)
response.raise_for_status()
result = response.json()

The response will be:

json
{
  "_updated": "Tue, 07 Oct 2025 08:15:30 GMT",
  "_created": "Tue, 07 Oct 2025 08:15:30 GMT",
  "_etag": "a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0",
  "_id": "68e4cb120da90297b3be0e01",
  "_status": "OK",
  "_payment_status": "completed"
}

Creditor Crediting

Credit part of the capital on a case using the Creditor Crediting endpoint. This reduces the outstanding capital amount on the case.

typescript
const creditData = {
  case: '68e4c40d93ee14723d28fa95',
  amount: 100.0,
  currency: 'SEK',
  origin: 'creditor_system',
}

const token = await auth.getValidToken()
const response = await axios.post(
  'https://api-sandbox.amili.se/creditor--creditings',
  creditData,
  {
    headers: {
      'X-API-Key': token,
      'Content-Type': 'application/json',
    },
  }
)
python
credit_data = {
    "case": "68e4c40d93ee14723d28fa95",
    "amount": 100.0,
    "currency": "SEK",
    "origin": "creditor_system"
}

token = auth.get_valid_token()
response = requests.post(
    'https://api-sandbox.amili.se/creditor--creditings',
    json=credit_data,
    headers={
        'X-API-Key': token,
        'Content-Type': 'application/json'
    }
)
response.raise_for_status()
result = response.json()

The response will be:

json
{
  "_updated": "Tue, 07 Oct 2025 07:51:56 GMT",
  "_created": "Tue, 07 Oct 2025 07:51:56 GMT",
  "_etag": "820ce3cd3b676e48d1ec0cc0b5cb46811ea2763e",
  "_id": "68e4c69c0da90297b3be0dfd",
  "_status": "OK",
  "_crediting_status": "completed"
}

Creditor Cancellation

Cancel a case entirely using the Creditor Cancellation endpoint. The creditor field is always required for cancellations.

typescript
const cancellationData = {
  creditor: '674dbeb208847b9501cc9138',
  case: '68e4c40d93ee14723d28fa95',
  origin: 'creditor_system',
}

const token = await auth.getValidToken()
const response = await axios.post(
  'https://api-sandbox.amili.se/creditor--cancellations',
  cancellationData,
  {
    headers: {
      'X-API-Key': token,
      'Content-Type': 'application/json',
    },
  }
)
python
cancellation_data = {
    "creditor": "674dbeb208847b9501cc9138",
    "case": "68e4c40d93ee14723d28fa95",
    "origin": "creditor_system"
}

token = auth.get_valid_token()
response = requests.post(
    'https://api-sandbox.amili.se/creditor--cancellations',
    json=cancellation_data,
    headers={
        'X-API-Key': token,
        'Content-Type': 'application/json'
    }
)
response.raise_for_status()
result = response.json()

The response will be:

json
{
  "_updated": "Tue, 07 Oct 2025 07:53:04 GMT",
  "_created": "Tue, 07 Oct 2025 07:53:04 GMT",
  "_etag": "d708022fbf6594c332235d07e952423b41dbdbcc",
  "_id": "68e4c6e07fcb697a78cb1a37",
  "_status": "OK",
  "_cancellation_status": "completed"
}

Case Respite (Postponement)

Postpone a case by a number of days using the respite domain action. This delays the next step in the case flow, giving the debtor more time before the case progresses further.

Important restrictions

  • A respite can only be granted before the case reaches the debt collection state. Once the case has been handed over for debt collection, it can no longer be postponed via this endpoint.
  • The maximum number of days is controlled by the case_config on the creditor or account level. The standard maximum is 30 days.
  • There are also configurable limits on the number of respites that can be granted per case and per customer.

You can first check whether a respite is available for a given case by sending a GET request. If the response is 200 OK, the action is allowed. If 206, the response will include an issues array explaining why respite is not available.

typescript
const caseId = '68e4c40d93ee14723d28fa95'

// Optional: check if respite is available
const checkResponse = await axios.get(
  `https://api-sandbox.amili.se/domain-actions/cases/respite/${caseId}`,
  {
    headers: {
      'X-API-Key': token,
      'Content-Type': 'application/json',
    },
  }
)

if (checkResponse.status === 200) {
  // Respite is allowed — proceed
  const token = await auth.getValidToken()
  const response = await axios.post(
    `https://api-sandbox.amili.se/domain-actions/cases/respite/${caseId}`,
    { days: 14 },
    {
      headers: {
        'X-API-Key': token,
        'Content-Type': 'application/json',
      },
    }
  )
}
python
case_id = "68e4c40d93ee14723d28fa95"

token = auth.get_valid_token()
headers = {
    "X-API-Key": token,
    "Content-Type": "application/json"
}

# Optional: check if respite is available
check_response = requests.get(
    f'https://api-sandbox.amili.se/domain-actions/cases/respite/{case_id}',
    headers=headers
)

if check_response.status_code == 200:
    # Respite is allowed — proceed
    response = requests.post(
        f'https://api-sandbox.amili.se/domain-actions/cases/respite/{case_id}',
        json={"days": 14},
        headers=headers
    )
    response.raise_for_status()

A successful response returns an empty body with status 200 OK:

json
{}