Skip to main content
GET
/
api
/
transactions
Transactions
curl --request GET \
  --url https://modelswitch.io/api/transactions
{
  "transactions": [
    {
      "id": 123,
      "amount": 123,
      "type": "<string>",
      "description": "<string>",
      "createdAt": "<string>"
    }
  ]
}
Returns a paginated list of all balance changes on your account, including inference charges, top-ups, and refunds. Authentication: Authorization: Bearer YOUR_JWT_TOKEN

Query parameters

limit
integer
default:"50"
Maximum number of records to return. Maximum value: 50.
offset
integer
default:"0"
Number of records to skip. Use with limit for pagination.

Example

curl "https://modelswitch.io/api/transactions?limit=50&offset=0" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN"

Response

{
  "transactions": [{
    "id": 1,
    "amount": -0.00345,
    "type": "usage",
    "description": "gpt-4o inference",
    "createdAt": "2024-01-15T14:22:05Z"
  }, {
    "id": 2,
    "amount": 1000.00,
    "type": "payment",
    "description": "Balance top-up",
    "createdAt": "2024-01-14T09:00:00Z"
  }]
}
transactions
array
List of transaction objects in reverse chronological order.

Transaction types

TypeAmountDescription
usageNegativeDeducted for an inference request
paymentPositiveBalance top-up via payment
refundPositiveRefund credited to account

Pagination

Use limit and offset to page through results. limit is capped at 50 per request. To retrieve your current balance directly, use the Balance API.