Skip to main content
POST
/
v1
/
platform
/
businesses
/
{business_id}
/
customer-credits
Create Customer Credit
curl --request POST \
  --url https://sandbox.thredfi.com/v1/platform/businesses/{business_id}/customer-credits/ \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "external_id": "<string>",
  "line_items": [
    {
      "amount": 2,
      "tax_amount_cents": 1,
      "revenue_account_identifier": "<unknown>",
      "memo": "<string>",
      "metadata": {},
      "reference_number": "<string>",
      "tags": [
        {}
      ]
    }
  ],
  "customer_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "customer_external_id": "<string>",
  "source_invoice_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "sent_at": "2023-11-07T05:31:56Z",
  "allocations": [
    {
      "amount": 2,
      "invoice_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
    }
  ],
  "tags": [
    {}
  ],
  "document": {
    "file": "<string>",
    "document_type": "customer_credit",
    "upload_source": "<string>",
    "metadata": "<unknown>",
    "tags": "<unknown>"
  }
}
'
{
  "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "status": "draft",
  "sent_at": "2023-11-07T05:31:56Z",
  "customer": {},
  "source_invoice_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "line_items": [
    {
      "amount": 123,
      "revenue_account_identifier": {
        "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
        "type": "AccountId"
      },
      "tags": [
        "<string>"
      ],
      "memo": "<string>",
      "metadata": "<unknown>"
    }
  ],
  "allocations": [
    {
      "invoice_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "invoice_number": "<string>",
      "amount_cents": 123,
      "invoice_outstanding_balance_cents": 123,
      "applied_at": "2023-11-07T05:31:56Z"
    }
  ],
  "tags": [
    {}
  ],
  "total_amount": 123,
  "applied_amount": 123,
  "document": {
    "url": "<string>",
    "expires_in": 123,
    "document_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "file_name": "<string>",
    "file_size": 123,
    "mime_type": "<string>"
  },
  "created_at": "2023-11-07T05:31:56Z",
  "updated_at": "2023-11-07T05:31:56Z",
  "external_id": "<string>",
  "currency": "EUR"
}

Authorizations

Authorization
string
header
required

Partner-level JWT token (unscoped). Token payload includes partner_id. Business access is validated via partner ownership. Format: Bearer <your-jwt-token>

Use this for: Multi-business operations where the business_id is specified in the URL and partner has access to multiple businesses.

Path Parameters

business_id
string<uuid>
required

Business UUID provided by Thred (unique identifier for the business)

Body

Customer credit creation serializer with line_items support.

Creates customer credits with line_items for flexible account allocation.

external_id
string
required

External system identifier for this customer credit

Minimum string length: 1
line_items
object[]
required

Array of line items for this customer credit

customer_id
string<uuid>

Existing customer ID to assign credit to

customer_external_id
string

External customer ID. Will create customer if not found

source_invoice_id
string<uuid> | null

Optional invoice ID this credit note was created from (origin tracking, not allocation)

sent_at
string<date-time>

When the credit was sent (ISO 8601 format). Defaults to now

allocations
object[]

Array of invoice allocations for this credit

tags
object[]

Transaction tags for the credit

document
object

Optional document upload

Response

Customer credit serializer for API responses.

id
string<uuid>
required

Unique customer credit identifier

status
enum<string>
required

Credit status: draft, sent, partially_applied, applied, void (computed from allocations)

Available options:
draft,
sent,
applied,
partially_applied,
void
sent_at
string<date-time>
required

When the credit was sent

customer
object
required

Customer receiving this credit (inline details)

source_invoice_id
string<uuid> | null
required

Invoice ID this credit was created from (origin tracking, not allocation)

line_items
object[]
required

Array of credit line items

allocations
object[]
required

Array of invoice allocations

tags
object[]
required

Transaction tags for the credit

total_amount
integer
required

Total credit amount in cents

applied_amount
integer
required

Applied credit amount in cents

document
object
required

Latest document linked to this customer credit

created_at
string<date-time>
required

Credit creation timestamp

updated_at
string<date-time>
required

Last update timestamp

external_id
string

Your external system identifier for this credit

Maximum string length: 255
currency
enum<string>

Credit currency (e.g., GBP, EUR, USD)

  • EUR - Euro
  • GBP - British Pound
  • USD - US Dollar
  • SEK - Swedish Krona
  • NOK - Norwegian Krone
  • DKK - Danish Krone
  • ISK - Icelandic Króna
  • MYR - Malaysian Ringgit
  • SGD - Singapore Dollar
Available options:
EUR,
GBP,
USD,
SEK,
NOK,
DKK,
ISK,
MYR,
SGD