aimldocs

Credits

prepaid balance, ledger, top-ups and invoices

GET
/v1/credits/contract
AuthorizationBearer <token>

In: header

Response Body

application/json

application/json

curl -X GET "https://example.com/v1/credits/contract"
{  "object": "contract",  "contract": {    "discount_bps": 750,    "commit_micro": 100000000,    "starts_on": "2026-10-01",    "ends_on": null,    "reference": "OF-17",    "status": "active"  },  "periods": [    {      "month": "2026-10-01T00:00:00Z",      "discount_bps": 750,      "commit_micro": 100000000,      "spend_micro": 40000000,      "rebate_micro": 3000000,      "shortfall_micro": 60000000,      "paid_as": "credit",      "closed_at": "2026-11-01T06:00:04Z"    }  ]}
POST
/v1/invoices/{id}/tax-invoice-link
AuthorizationBearer <token>

In: header

Path Parameters

id*string

Response Body

application/json

application/json

curl -X POST "https://example.com/v1/invoices/string/tax-invoice-link"
{  "url": "https://billing.example.com/oauth/singlesignon.php?access_token=one-time",  "number": "2627-314"}
POST
/v1/invoices/{id}/resend
AuthorizationBearer <token>

In: header

Path Parameters

id*string

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

curl -X POST "https://example.com/v1/invoices/string/resend" \  -H "Content-Type: application/json" \  -d '{    "to": "[email protected]"  }'
{  "queued": true,  "to": "[email protected]"}
GET
/v1/credits
AuthorizationBearer <token>

In: header

Response Body

application/json

application/json

curl -X GET "https://example.com/v1/credits"
{  "available_micro_usd": 12345678,  "held_micro_usd": 250000,  "granted_micro_usd": 0,  "display": {    "currency": "INR",    "amount": "1036.02"  },  "currency": "INR",  "fx_rate": "83.91750000"}
GET
/v1/credits/checkin
AuthorizationBearer <token>

In: header

Response Body

application/json

application/json

curl -X GET "https://example.com/v1/credits/checkin"
{  "enabled": true,  "amount_micro_usd": 50000,  "credit_days": 7,  "done_today": false,  "streak_days": 4}
POST
/v1/credits/checkin
AuthorizationBearer <token>

In: header

Response Body

application/json

application/json

curl -X POST "https://example.com/v1/credits/checkin"
{  "day": "2026-09-30",  "amount_micro_usd": 50000,  "ledger_seq": 44,  "credit_expires_at": "2026-10-07T10:00:00Z"}
GET
/v1/credits/gifts
AuthorizationBearer <token>

In: header

Response Body

application/json

application/json

curl -X GET "https://example.com/v1/credits/gifts"
{  "object": "list",  "data": [    {      "id": "gift_01J9ZK2K4Q7Q3M3QX1V0F1GATE",      "amount_micro_usd": 20000000,      "hint": "W8D5",      "status": "redeemed",      "expires_at": "2026-12-29T10:00:00Z",      "created_at": "2026-09-30T10:00:00Z",      "closed_at": "2026-10-01T09:00:00Z"    }  ]}
POST
/v1/credits/gifts
AuthorizationBearer <token>

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

curl -X POST "https://example.com/v1/credits/gifts" \  -H "Content-Type: application/json" \  -d '{    "amount_micro_usd": 20000000,    "note": "hackathon prize"  }'
{  "id": "gift_01J9ZK2K4Q7Q3M3QX1V0F1GATE",  "amount_micro_usd": 20000000,  "hint": "W8D5",  "note": "hackathon prize",  "status": "open",  "expires_at": "2026-12-29T10:00:00Z",  "created_at": "2026-09-30T10:00:00Z",  "code": "AIML-7K2Q-9MXR-4TZB-HP3N-W8D5"}
DELETE
/v1/credits/gifts/{id}
AuthorizationBearer <token>

In: header

Path Parameters

id*string

Response Body

application/json

application/json

curl -X DELETE "https://example.com/v1/credits/gifts/string"
{  "id": "gift_01J9ZK2K4Q7Q3M3QX1V0F1GATE",  "status": "cancelled"}
POST
/v1/credits/redeem
AuthorizationBearer <token>

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

curl -X POST "https://example.com/v1/credits/redeem" \  -H "Content-Type: application/json" \  -d '{    "code": "AIML-7K2Q-9MXR-4TZB-HP3N-W8D5"  }'
{  "id": "red_01J9ZK2K4Q7Q3M3QX1V0F1GATE",  "amount_micro_usd": 5000000,  "ledger_seq": 43,  "credit_expires_at": "2026-12-29T00:00:00Z",  "batch": "launch week"}
GET
/v1/credits/redemptions
AuthorizationBearer <token>

In: header

Response Body

application/json

application/json

curl -X GET "https://example.com/v1/credits/redemptions"
{  "object": "list",  "data": [    {      "id": "red_01J9ZK2K4Q7Q3M3QX1V0F1GATE",      "batch": "launch week",      "amount_micro_usd": 5000000,      "ledger_seq": 43,      "created_at": "2026-09-29T10:00:00Z"    }  ]}
GET
/v1/credits/ledger
AuthorizationBearer <token>

In: header

Query Parameters

cursor?string
limit?integer
Rangevalue <= 500
kind?string
format?unknown

csv streams the page as text/csv

Value in

  • "json"
  • "csv"

Response Body

application/json

curl -X GET "https://example.com/v1/credits/ledger"
{  "object": "list",  "data": [    {      "seq": 42,      "kind": "settle",      "amount_micro_usd": -489,      "request_id": "01J9ZK2K4Q7Q3M3QX1V0F1GATE",      "created_at": "2026-09-10T11:59:01Z"    },    {      "seq": 41,      "kind": "topup",      "amount_micro_usd": 11916466,      "ref_type": "topup",      "ref_id": "tup_01J9ZK2K4Q7Q3M3QX1V0F1TUP1",      "created_at": "2026-09-10T11:59:30Z"    }  ],  "next_cursor": ""}
GET
/v1/credits/reconciliation
AuthorizationBearer <token>

In: header

Query Parameters

from?string

first day (UTC), YYYY-MM-DD; default 29 days before to

Formatdate
to?string

last day (UTC), YYYY-MM-DD, inclusive; default today. At most 92 days in one report.

Formatdate
format?unknown

csv returns the same rows plus a total line as text/csv

Value in

  • "json"
  • "csv"

Response Body

application/json

curl -X GET "https://example.com/v1/credits/reconciliation"
{  "object": "reconciliation",  "from": "2026-09-09",  "to": "2026-09-10",  "timezone": "UTC",  "analytics": true,  "days": [    {      "day": "2026-09-09",      "opening_micro": 0,      "added_micro": 11916466,      "charged_micro": 4210,      "other_debits_micro": 0,      "closing_micro": 11912256,      "usage_micro": 4210,      "requests": 12,      "variance_micro": 0    },    {      "day": "2026-09-10",      "opening_micro": 11912256,      "added_micro": 0,      "charged_micro": 1880,      "other_debits_micro": 0,      "closing_micro": 11910376,      "usage_micro": 1880,      "requests": 5,      "variance_micro": 0    }  ],  "totals": {    "opening_micro": 0,    "added_micro": 11916466,    "charged_micro": 6090,    "other_debits_micro": 0,    "closing_micro": 11910376,    "usage_micro": 6090,    "requests": 17,    "variance_micro": 0  }}
GET
/v1/credits/topups/quote
AuthorizationBearer <token>

In: header

Query Parameters

amount_minor*integer
Range1 <= value
gateway?unknown

price the top-up on this gateway rather than the default; one that cannot collect the organization's billing currency is schema_invalid on gateway

Value in

  • "stripe"
  • "razorpay"

Response Body

application/json

application/json

curl -X GET "https://example.com/v1/credits/topups/quote?amount_minor=1"
{  "rail": "razorpay",  "currency": "INR",  "amount_minor": 100000,  "tax_minor": 18000,  "total_minor": 118000,  "credits_micro": 11916466,  "fx_rate": "83.91750000",  "fx_day": "2026-09-10",  "fees": {    "rail": "razorpay",    "items": [      {        "method": "upi",        "bps": 0      },      {        "method": "netbanking",        "bps": 190      },      {        "method": "card_domestic",        "bps": 200      },      {        "method": "card_international",        "bps": 350      }    ]  },  "min_amount_minor": 50000,  "display": "INR 1000.00 of credits (USD 11.92) + tax INR 180.00 = INR 1180.00",  "gateways": [    {      "gateway": "razorpay",      "default": true,      "fees": {        "rail": "razorpay",        "items": [          {            "method": "upi",            "bps": 0          },          {            "method": "netbanking",            "bps": 190          },          {            "method": "card_domestic",            "bps": 200          },          {            "method": "card_international",            "bps": 350          }        ]      },      "total_minor": 118000,      "fee_min_minor": 0,      "fee_max_minor": 4130    },    {      "gateway": "stripe",      "default": false,      "fees": {        "rail": "stripe",        "items": [          {            "method": "card_domestic",            "bps": 200          },          {            "method": "debit_card_domestic",            "bps": 40,            "cap_minor": 20000          },          {            "method": "card_international",            "bps": 300          }        ]      },      "total_minor": 118000,      "fee_min_minor": 472,      "fee_max_minor": 3540    }  ]}
GET
/v1/credits/reseller-payments
AuthorizationBearer <token>

In: header

Query Parameters

cursor?string
limit?integer
Rangevalue <= 200

Response Body

application/json

application/json

curl -X GET "https://example.com/v1/credits/reseller-payments"
{  "object": "list",  "collector": {    "reseller_id": "org_01J9ZK2K4Q7Q3M3QX1V0RESELL",    "name": "Acme AI",    "gateway": "stripe",    "currency": "GBP",    "tax_name": "VAT",    "tax_rate_bps": 2000,    "tax_inclusive": false,    "fee_bps": 0,    "ready": true  },  "data": [    {      "id": "rcp_01J9ZK2K4Q7Q3M3QX1V0PAYMNT",      "org_id": "org_01J9ZK2K4Q7Q3M3QX1V0CUSTMR",      "gateway": "stripe",      "currency": "GBP",      "amount_minor": 10000,      "tax_minor": 2000,      "total_minor": 12000,      "fee_minor": 0,      "fx_rate": "0.8000",      "credits_micro": 125000000,      "status": "awaiting_funds",      "source": "reseller",      "created_at": "2026-11-18T10:00:00Z"    }  ],  "next_cursor": ""}
GET
/v1/credits/topups
AuthorizationBearer <token>

In: header

Query Parameters

cursor?string
limit?integer
Rangevalue <= 200

Response Body

application/json

application/json

curl -X GET "https://example.com/v1/credits/topups"
{  "object": "list",  "data": [    {      "id": "tup_01J9ZK2K4Q7Q3M3QX1V0F1TUP1",      "org_id": "org_01J9ZK2K4Q7Q3M3QX1V0F1ORG1",      "gateway": "razorpay",      "gateway_ref": "plink_Q9Mt7xF2d0kXtR",      "payment_ref": "pay_Q9MtPL2eZvKYlo",      "currency": "INR",      "amount_minor": 100000,      "tax_minor": 18000,      "total_minor": 118000,      "fee_minor": 0,      "fx_rate": "83.91750000",      "credits_micro": 11916466,      "method": "upi",      "status": "paid",      "invoice_id": "inv_01J9ZK2K4Q7Q3M3QX1V0F1INV1",      "source": "checkout",      "created_at": "2026-09-10T11:58:00Z",      "paid_at": "2026-09-10T11:59:30Z"    }  ]}
POST
/v1/credits/topups
AuthorizationBearer <token>

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

curl -X POST "https://example.com/v1/credits/topups" \  -H "Content-Type: application/json" \  -d '{    "amount_minor": 100000  }'
{  "topup": {    "id": "tup_01J9ZK2K4Q7Q3M3QX1V0F1TUP1",    "org_id": "org_01J9ZK2K4Q7Q3M3QX1V0F1ORG1",    "gateway": "razorpay",    "gateway_ref": "plink_Q9Mt7xF2d0kXtR",    "currency": "INR",    "amount_minor": 100000,    "tax_minor": 18000,    "total_minor": 118000,    "fee_minor": 0,    "fx_rate": "83.91750000",    "credits_micro": 11916466,    "method": "upi",    "status": "pending",    "source": "checkout",    "created_at": "2026-09-10T11:58:00Z",    "checkout_url": "https://rzp.io/i/Q9Mt7xF2"  },  "checkout_url": "https://rzp.io/i/Q9Mt7xF2",  "quote": {    "rail": "razorpay",    "currency": "INR",    "amount_minor": 100000,    "tax_minor": 18000,    "total_minor": 118000,    "credits_micro": 11916466,    "fx_rate": "83.91750000",    "fx_day": "2026-09-10",    "fees": {      "rail": "razorpay",      "items": [        {          "method": "upi",          "bps": 0        },        {          "method": "netbanking",          "bps": 190        },        {          "method": "card_domestic",          "bps": 200        },        {          "method": "card_international",          "bps": 350        }      ]    },    "min_amount_minor": 50000,    "display": "INR 1000.00 of credits (USD 11.92) + tax INR 180.00 = INR 1180.00"  }}
GET
/v1/credits/topups/{id}
AuthorizationBearer <token>

In: header

Path Parameters

id*string

Response Body

application/json

application/json

curl -X GET "https://example.com/v1/credits/topups/string"
{  "id": "tup_01J9ZK2K4Q7Q3M3QX1V0F1TUP1",  "org_id": "org_01J9ZK2K4Q7Q3M3QX1V0F1ORG1",  "gateway": "razorpay",  "gateway_ref": "plink_Q9Mt7xF2d0kXtR",  "payment_ref": "pay_Q9MtPL2eZvKYlo",  "currency": "INR",  "amount_minor": 100000,  "tax_minor": 18000,  "total_minor": 118000,  "fee_minor": 0,  "fx_rate": "83.91750000",  "credits_micro": 11916466,  "method": "upi",  "status": "paid",  "invoice_id": "inv_01J9ZK2K4Q7Q3M3QX1V0F1INV1",  "source": "checkout",  "created_at": "2026-09-10T11:58:00Z",  "paid_at": "2026-09-10T11:59:30Z"}
POST
/v1/credits/topups/{id}/refund
AuthorizationBearer <token>

In: header

Path Parameters

id*string

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/v1/credits/topups/string/refund" \  -H "Content-Type: application/json" \  -d '{    "amount_minor": 30000,    "reason": "unused",    "idempotency_key": "rf-2026-09-10-1"  }'
{  "refund": {    "id": "rfd_01J9ZK2K4Q7Q3M3QX1V0F1RFD1",    "org_id": "org_01J9ZK2K4Q7Q3M3QX1V0F1ORG1",    "topup_id": "tup_01J9ZK2K4Q7Q3M3QX1V0F1TUP1",    "gateway": "razorpay",    "payment_ref": "pay_Q9MtPL2eZvKYlo",    "gateway_ref": "rfnd_Q9MtR5x",    "currency": "INR",    "amount_minor": 30000,    "tax_minor": 5400,    "total_minor": 35400,    "fx_rate": "83.91750000",    "credits_micro": 3574940,    "credit_note_id": "cn_01J9ZK2K4Q7Q3M3QX1V0F1CN01",    "status": "refunded",    "reason": "unused",    "created_at": "2026-09-10T13:00:00Z",    "settled_at": "2026-09-10T13:00:01Z",    "replay": true  }}
GET
/v1/credits/refunds
AuthorizationBearer <token>

In: header

Query Parameters

cursor?string
limit?integer
Rangevalue <= 200

Response Body

application/json

application/json

curl -X GET "https://example.com/v1/credits/refunds"
{  "data": [    {      "id": "rfd_01J9ZK2K4Q7Q3M3QX1V0F1RFD1",      "org_id": "org_01J9ZK2K4Q7Q3M3QX1V0F1ORG1",      "topup_id": "tup_01J9ZK2K4Q7Q3M3QX1V0F1TUP1",      "gateway": "razorpay",      "payment_ref": "pay_Q9MtPL2eZvKYlo",      "gateway_ref": "rfnd_Q9MtR5x",      "currency": "INR",      "amount_minor": 30000,      "tax_minor": 5400,      "total_minor": 35400,      "fx_rate": "83.91750000",      "credits_micro": 3574940,      "credit_note_id": "cn_01J9ZK2K4Q7Q3M3QX1V0F1CN01",      "status": "refunded",      "reason": "unused",      "created_at": "2026-09-10T13:00:00Z",      "settled_at": "2026-09-10T13:00:01Z"    }  ]}
GET
/v1/credits/refunds/{id}
AuthorizationBearer <token>

In: header

Path Parameters

id*string

Response Body

application/json

application/json

curl -X GET "https://example.com/v1/credits/refunds/string"
{  "refund": {    "id": "rfd_01J9ZK2K4Q7Q3M3QX1V0F1RFD1",    "org_id": "org_01J9ZK2K4Q7Q3M3QX1V0F1ORG1",    "topup_id": "tup_01J9ZK2K4Q7Q3M3QX1V0F1TUP1",    "gateway": "razorpay",    "payment_ref": "pay_Q9MtPL2eZvKYlo",    "gateway_ref": "rfnd_Q9MtR5x",    "currency": "INR",    "amount_minor": 30000,    "tax_minor": 5400,    "total_minor": 35400,    "fx_rate": "83.91750000",    "credits_micro": 3574940,    "credit_note_id": "cn_01J9ZK2K4Q7Q3M3QX1V0F1CN01",    "status": "refunded",    "reason": "unused",    "created_at": "2026-09-10T13:00:00Z",    "settled_at": "2026-09-10T13:00:01Z"  }}
GET
/v1/credits/auto-topup
AuthorizationBearer <token>

In: header

Response Body

application/json

application/json

curl -X GET "https://example.com/v1/credits/auto-topup"
{  "mandate": {    "id": "mnd_01J9ZK2K4Q7Q3M3QX1V0F1MND1",    "org_id": "org_01J9ZK2K4Q7Q3M3QX1V0F1ORG1",    "gateway": "razorpay",    "method": "upi",    "mandate_ref": "inv_auth1",    "token_ref": "token_1",    "max_amount_minor": 1500000,    "currency": "INR",    "status": "active",    "auto_topup": {      "enabled": true,      "threshold_micro": 5000000,      "amount_minor": 100000    },    "notify_hours": 24,    "consecutive_failures": 0,    "registered_at": "2026-09-02T10:00:00Z",    "created_at": "2026-09-02T09:58:00Z"  },  "config": {    "enabled": true,    "threshold_micro": 5000000,    "amount_minor": 100000  },  "rail": "razorpay",  "methods": [    "upi",    "emandate",    "card"  ],  "cap_minor": 1500000,  "notify_hours": 24,  "currency": "INR",  "min_amount_minor": 50000}
PUT
/v1/credits/auto-topup
AuthorizationBearer <token>

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

curl -X PUT "https://example.com/v1/credits/auto-topup" \  -H "Content-Type: application/json" \  -d '{    "enabled": true,    "threshold_micro": 5000000,    "amount_minor": 100000  }'
{  "mandate": {    "id": "mnd_01J9ZK2K4Q7Q3M3QX1V0F1MND1",    "org_id": "org_01J9ZK2K4Q7Q3M3QX1V0F1ORG1",    "gateway": "razorpay",    "method": "upi",    "mandate_ref": "inv_auth1",    "token_ref": "token_1",    "max_amount_minor": 1500000,    "currency": "INR",    "status": "active",    "auto_topup": {      "enabled": true,      "threshold_micro": 5000000,      "amount_minor": 100000    },    "notify_hours": 24,    "consecutive_failures": 0,    "registered_at": "2026-09-02T10:00:00Z",    "created_at": "2026-09-02T09:58:00Z"  },  "config": {    "enabled": true,    "threshold_micro": 5000000,    "amount_minor": 100000  },  "rail": "razorpay",  "methods": [    "upi",    "emandate",    "card"  ],  "cap_minor": 1500000,  "notify_hours": 24,  "currency": "INR",  "min_amount_minor": 50000}
POST
/v1/credits/mandates
AuthorizationBearer <token>

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

curl -X POST "https://example.com/v1/credits/mandates" \  -H "Content-Type: application/json" \  -d '{    "method": "upi"  }'
{  "mandate": {    "id": "mnd_01J9ZK2K4Q7Q3M3QX1V0F1MND1",    "org_id": "org_01J9ZK2K4Q7Q3M3QX1V0F1ORG1",    "gateway": "razorpay",    "method": "upi",    "mandate_ref": "inv_auth1",    "max_amount_minor": 1500000,    "currency": "INR",    "status": "pending",    "auto_topup": {      "enabled": false,      "threshold_micro": 5000000,      "amount_minor": 100000    },    "notify_hours": 24,    "consecutive_failures": 0,    "created_at": "2026-09-02T09:58:00Z",    "hosted_url": "https://rzp.io/i/authQ9Mt"  },  "url": "https://rzp.io/i/authQ9Mt"}
DELETE
/v1/credits/mandates
AuthorizationBearer <token>

In: header

Response Body

application/json

application/json

curl -X DELETE "https://example.com/v1/credits/mandates"
{  "mandate": {    "id": "mnd_01J9ZK2K4Q7Q3M3QX1V0F1MND1",    "org_id": "org_01J9ZK2K4Q7Q3M3QX1V0F1ORG1",    "gateway": "razorpay",    "method": "upi",    "mandate_ref": "inv_auth1",    "token_ref": "token_1",    "max_amount_minor": 1500000,    "currency": "INR",    "status": "cancelled",    "auto_topup": {      "enabled": false,      "threshold_micro": 5000000,      "amount_minor": 100000    },    "notify_hours": 24,    "consecutive_failures": 0,    "registered_at": "2026-09-02T10:00:00Z",    "created_at": "2026-09-02T09:58:00Z",    "cancelled_at": "2026-09-11T09:00:00Z"  }}
POST
/v1/invoices/{id}/correction
AuthorizationBearer <token>

In: header

Path Parameters

id*string

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

curl -X POST "https://example.com/v1/invoices/string/correction" \  -H "Content-Type: application/json" \  -d '{    "gstin": "29CCCCC2222C1Z5",    "reason": "moved to Bengaluru"  }'
{  "status": "ticket",  "ticket": {    "id": "tkt_01J9ZK2K4Q7Q3M3QX1V0F1TKT1",    "org_id": "org_01J9ZK2K4Q7Q3M3QX1V0F1ORG1",    "kind": "invoice_correction",    "status": "open",    "subject": "correction for AIML/26-27/000001",    "body": {      "invoice_id": "inv_01J9ZK2K4Q7Q3M3QX1V0F1INV1",      "gstin": "29CCCCC2222C1Z5",      "reason": "moved to Bengaluru"    },    "created_by": "[email protected]",    "created_at": "2026-09-08T10:00:00Z"  }}
POST
/v1/invoices/{id}/dispute
AuthorizationBearer <token>

In: header

Path Parameters

id*string

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

curl -X POST "https://example.com/v1/invoices/string/dispute" \  -H "Content-Type: application/json" \  -d '{    "line": 2,    "reason": "the processing fee was charged twice"  }'
{  "status": "ticket",  "ticket": {    "id": "tkt_01J9ZK2K4Q7Q3M3QX1V0F1TKT2",    "org_id": "org_01J9ZK2K4Q7Q3M3QX1V0F1ORG1",    "kind": "invoice_dispute",    "status": "open",    "subject": "dispute of AIML/26-27/000001",    "body": {      "invoice_id": "inv_01J9ZK2K4Q7Q3M3QX1V0F1INV1",      "line": 2,      "amount_minor": 2000,      "currency": "INR",      "reason": "the processing fee was charged twice"    },    "created_by": "[email protected]",    "created_at": "2026-10-08T10:00:00Z"  }}
GET
/v1/affiliate
AuthorizationBearer <token>

In: header

Response Body

application/json

application/json

curl -X GET "https://example.com/v1/affiliate"
{  "enabled": true,  "code": "7K2Q9MXR",  "link": "https://console.ai.ml/start?ref=7K2Q9MXR",  "bps": 1000,  "months": 12,  "hold_days": 30,  "min_withdrawal_micro_usd": 50000000,  "stats": {    "referred_orgs": 3,    "earned_micro_usd": 60000000,    "withdrawn_micro_usd": 0,    "pending_micro_usd": 12000000  },  "withdrawals": []}
POST
/v1/affiliate/withdrawals
AuthorizationBearer <token>

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

curl -X POST "https://example.com/v1/affiliate/withdrawals" \  -H "Content-Type: application/json" \  -d '{    "amount_micro_usd": 55000000  }'
{  "id": "wd_01J9ZK2K4Q7Q3M3QX1V0F1GATE",  "amount_micro_usd": 55000000,  "status": "requested",  "created_at": "2026-09-30T10:00:00Z"}
GET
/v1/plans
AuthorizationBearer <token>

In: header

Response Body

application/json

application/json

curl -X GET "https://example.com/v1/plans"
{  "data": [    {      "id": "payg",      "name": "Pay as you go",      "monthly_minor": 0,      "currency": "",      "included_micro": 0,      "limits": {        "rpm": 600,        "tpm": 2000000,        "concurrency": 32,        "keys": 50,        "projects": 10      },      "features": {},      "description": "Prepaid credits, no monthly fee.",      "public": true,      "sort": 10    },    {      "id": "team-small",      "name": "Team S",      "monthly_minor": 4900,      "currency": "USD",      "included_micro": 50000000,      "limits": {        "rpm": 3000,        "tpm": 10000000,        "concurrency": 128,        "keys": 200,        "projects": 50      },      "features": {        "priority_support": false,        "sso": false      },      "description": "USD 49 per month, USD 50 of credits included, higher limits.",      "public": true,      "sort": 20    }  ]}
GET
/v1/billing/subscription
AuthorizationBearer <token>

In: header

Response Body

application/json

application/json

curl -X GET "https://example.com/v1/billing/subscription"
{  "subscription": {    "org_id": "org_01J9ZK2K4Q7Q3M3QX1V0F1ORG1",    "plan_id": "team-small",    "status": "active",    "period_start": "2026-09-01T00:00:00Z",    "period_end": "2026-10-01T00:00:00Z",    "started_at": "2026-09-10T15:00:00Z"  },  "plan": {    "id": "team-small",    "name": "Team S",    "monthly_minor": 4900,    "currency": "USD",    "included_micro": 50000000,    "limits": {      "rpm": 3000,      "tpm": 10000000,      "concurrency": 128,      "keys": 200,      "projects": 50    },    "features": {      "priority_support": false,      "sso": false    },    "description": "USD 49 per month, USD 50 of credits included, higher limits.",    "public": true,    "sort": 20  }}
POST
/v1/billing/subscription
AuthorizationBearer <token>

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

curl -X POST "https://example.com/v1/billing/subscription" \  -H "Content-Type: application/json" \  -d '{    "plan_id": "team-small"  }'
{  "subscription": {    "org_id": "org_01J9ZK2K4Q7Q3M3QX1V0F1ORG1",    "plan_id": "team-small",    "status": "active",    "period_start": "2026-09-01T00:00:00Z",    "period_end": "2026-10-01T00:00:00Z",    "started_at": "2026-09-10T15:00:00Z"  },  "plan": {    "id": "team-small",    "name": "Team S",    "monthly_minor": 4900,    "currency": "USD",    "included_micro": 50000000,    "limits": {      "rpm": 3000,      "tpm": 10000000,      "concurrency": 128,      "keys": 200,      "projects": 50    },    "features": {      "priority_support": false,      "sso": false    },    "description": "USD 49 per month, USD 50 of credits included, higher limits.",    "public": true,    "sort": 20  },  "invoice": {    "id": "inv_01J9ZK2K4Q7Q3M3QX1V0F1INV2",    "org_id": "org_01J9ZK2K4Q7Q3M3QX1V0F1ORG1",    "number": "AIML/26-27/000002",    "fy": "26-27",    "kind": "tax_invoice",    "currency": "INR",    "place_of_supply": "23",    "supplier_gstin": "23AAAAA0000A1Z5",    "recipient_gstin": "23AAAAA0000A1ZA",    "recipient": {      "legal_name": "Acme Pvt Ltd",      "gstin": "23AAAAA0000A1ZA",      "country": "IN"    },    "lines": [      {        "description": "Team S plan · 01 Sep – 30 Sep 2026 (prorated 21/30 days) (USD 34.30 at 1 USD = 83.91750000 INR)",        "kind": "proration",        "sac": "998315",        "quantity": 1,        "unit_minor": 287837,        "amount_minor": 287837      }    ],    "taxable_minor": 287837,    "cgst_minor": 25905,    "sgst_minor": 25905,    "igst_minor": 0,    "total_minor": 339647,    "hsn_sac": "998315",    "irn_status": "generated",    "irn": "cb2f7329dc18db6262dd1365844b7ef5e6d3550753067424beaf06d35a286674",    "fx_rate": "83.91750000",    "issued_at": "2026-09-10T11:59:30Z",    "status": "paid",    "credited_minor": 0,    "plan_id": "team-small",    "period_start": "2026-09-01T00:00:00Z",    "period_end": "2026-10-01T00:00:00Z"  },  "fee_micro": 34300000,  "included_micro": 35000000,  "prorated_bps": 7000,  "effective": "now"}
GET
/v1/invoices
AuthorizationBearer <token>

In: header

Query Parameters

cursor?string
limit?integer
Rangevalue <= 200
month?string

documents issued in this month (YYYY-MM, India time)

format?unknown

csv returns the document register as one text/csv file for an accounting import, not a page: one row per line of every matching document, oldest first, with the document's totals and tax split on each row and amounts as decimals in the document's currency. At most 5,000 documents; more is refused with export_too_large

Value in

  • "json"
  • "csv"

Response Body

application/json

curl -X GET "https://example.com/v1/invoices"
{  "object": "list",  "data": [    {      "id": "inv_01J9ZK2K4Q7Q3M3QX1V0F1INV1",      "org_id": "org_01J9ZK2K4Q7Q3M3QX1V0F1ORG1",      "number": "AIML/26-27/000001",      "fy": "26-27",      "kind": "tax_invoice",      "currency": "INR",      "place_of_supply": "23",      "supplier_gstin": "23AAAAA0000A1Z5",      "recipient_gstin": "23AAAAA0000A1ZA",      "recipient": {        "legal_name": "Acme Pvt Ltd",        "gstin": "23AAAAA0000A1ZA",        "country": "IN"      },      "lines": [        {          "description": "Prepaid API credits (USD 11.92 at 1 USD = 83.91750000 INR)",          "kind": "credits",          "sac": "998315",          "quantity": 1,          "unit_minor": 100000,          "amount_minor": 100000        }      ],      "taxable_minor": 100000,      "cgst_minor": 9000,      "sgst_minor": 9000,      "igst_minor": 0,      "total_minor": 118000,      "hsn_sac": "998315",      "irn_status": "generated",      "irn": "cb2f7329dc18db6262dd1365844b7ef5e6d3550753067424beaf06d35a286674",      "topup_id": "tup_01J9ZK2K4Q7Q3M3QX1V0F1TUP1",      "fx_rate": "83.91750000",      "issued_at": "2026-09-10T11:59:30Z",      "status": "paid",      "credited_minor": 0    }  ]}
GET
/v1/invoices/{id}
AuthorizationBearer <token>

In: header

Path Parameters

id*string

Response Body

application/json

application/json

curl -X GET "https://example.com/v1/invoices/string"
{  "id": "inv_01J9ZK2K4Q7Q3M3QX1V0F1INV1",  "org_id": "org_01J9ZK2K4Q7Q3M3QX1V0F1ORG1",  "number": "AIML/26-27/000001",  "fy": "26-27",  "kind": "tax_invoice",  "currency": "INR",  "place_of_supply": "23",  "supplier_gstin": "23AAAAA0000A1Z5",  "recipient_gstin": "23AAAAA0000A1ZA",  "recipient": {    "legal_name": "Acme Pvt Ltd",    "gstin": "23AAAAA0000A1ZA",    "country": "IN"  },  "lines": [    {      "description": "Prepaid API credits (USD 11.92 at 1 USD = 83.91750000 INR)",      "kind": "credits",      "sac": "998315",      "quantity": 1,      "unit_minor": 100000,      "amount_minor": 100000    }  ],  "taxable_minor": 100000,  "cgst_minor": 9000,  "sgst_minor": 9000,  "igst_minor": 0,  "total_minor": 118000,  "hsn_sac": "998315",  "irn_status": "generated",  "irn": "cb2f7329dc18db6262dd1365844b7ef5e6d3550753067424beaf06d35a286674",  "topup_id": "tup_01J9ZK2K4Q7Q3M3QX1V0F1TUP1",  "fx_rate": "83.91750000",  "issued_at": "2026-09-10T11:59:30Z",  "status": "paid",  "credited_minor": 0}
GET
/v1/invoices/{id}/pdf
AuthorizationBearer <token>

In: header

Path Parameters

id*string

Response Body

application/pdf

application/json

curl -X GET "https://example.com/v1/invoices/string/pdf"
"string"
GET
/v1/invoices/{id}/html
AuthorizationBearer <token>

In: header

Path Parameters

id*string

Response Body

text/html

application/json

curl -X GET "https://example.com/v1/invoices/string/html"
"string"