Gallantree Developer API

Idempotency

Every write endpoint (POST, PUT, DELETE) supports the Idempotency-Key header. This lets you retry safely — a network hiccup, a client timeout, a container restart — without accidentally creating the same resource twice.

The rule

What counts as "the same key"

A key that matches on all three replays the stored response. A key that matches only some of them is treated as a new request.

What about a different body?

If you re-send the same Idempotency-Key with a different request body, the API returns 409 Conflict:

JSON
{ "message": "Idempotency key conflict: the same key was used with a different request body." }

This is a safety measure — it prevents a client bug from silently overwriting a stored response. Fix the client or use a fresh key.

Choosing a key

What idempotency does not do

Runnable example

Shell
KEY=$(uuidgen)   # uuidgen produces a v4 UUID on macOS and most Linux distributions

# The minimal handover payload from the Loans guide.
cat > loan.json <<'JSON'
{
  "source": "my-integration",
  "organisations": [
    {
      "externalId": "borrower-001",
      "organisationName": "Test Borrower Holdings Pty Ltd",
      "organisationStructure": "privateCompany",
      "domicile": "australia",
      "roles": ["borrower"],
      "registrations": { "abn": "12345678901" }
    },
    {
      "externalId": "lender-001",
      "organisationName": "Sandbox Lender Alpha",
      "domicile": "australia"
    }
  ],
  "collaterals": [
    {
      "externalId": "collateral-001",
      "collateralType": "property",
      "address": "1 Sample St, Sydney NSW 2000",
      "values": { "current": 2500000 }
    }
  ],
  "loan": {
    "externalId": "loan-001",
    "category": "cre",
    "borrowingEntityExternalId": "borrower-001",
    "servicerExternalId": "lender-001",
    "lenderOfRecordExternalId": "lender-001",
    "collateralExternalIds": ["collateral-001"],
    "capitalProgram": {
      "externalId": "program-001",
      "name": "Sandbox CRE Program",
      "domicile": "australia"
    },
    "product": {
      "externalId": "product-001",
      "name": "CRE Senior 5yr"
    },
    "principalAmount": 1500000,
    "loanTerm": 60
  }
}
JSON

# First attempt — actually creates the loan
curl -sS -X POST https://developers.gallantreecapital.com/api/v1/loans \
  -H "x-api-key: $GALLANTREE_API_KEY" \
  -H "Idempotency-Key: $KEY" \
  -H "Content-Type: application/json" \
  --data-binary @loan.json

# Retry after a client-side timeout — same key, same body: returns the original response, no duplicate
curl -sS -X POST https://developers.gallantreecapital.com/api/v1/loans \
  -H "x-api-key: $GALLANTREE_API_KEY" \
  -H "Idempotency-Key: $KEY" \
  -H "Content-Type: application/json" \
  --data-binary @loan.json

See Loans → Create for the full payload.

Was this page helpful?

Built with Token Gesture