---
title: "Create Invoice"
method: POST
path: "/api/invoices"
tags: ["Invoices"]
---

# Create Invoice

`POST /api/invoices`

## Request

- Base URL: `https://api.agentstack.tech` (the document declares no server; this is the origin it was published from)
- URL: `https://api.agentstack.tech/api/invoices`
- Auth: one of:
  - API key in header `X-API-Key`
  - HTTP bearer

Создание инвойса

Body:
    - type: payment | transfer | exchange
    - to_user_id: ID получателя
    - to_wallet_id: ID кошелька получателя
    - amount: Сумма (decimal string)
    - currency: Валюта
    - description: Описание
    - expires_days: Количество дней до истечения (по умолчанию 7)
    - from_wallet_id: ID кошелька отправителя (для transfer)
    - items: Элементы обмена (для exchange)
    - exchange_rate: Курс обмена (для exchange, опционально)

## Headers

- `Idempotency-Key` string

## Request body

- CreateInvoiceBody: Request body for creating an invoice.
  - `type` string, required: payment | transfer | exchange
  - `to_user_id` integer, required: Recipient user ID
  - `to_wallet_id` string, required: Recipient wallet ID
  - `amount` string, required: Amount as decimal string
  - `currency` string: Currency code
  - `description` string: Description
  - `expires_days` integer, nullable: Days until expiry
  - `from_wallet_id` string, nullable: Sender wallet (transfer)
  - `from_user_id` integer, nullable: Sender user (transfer/exchange)
  - `items` object[], nullable: Exchange items
  - `exchange_rate` object, nullable: Exchange rate

## Response `200`

Successful Response

- unknown

## Other responses

- `400`: Bad Request
- `401`: Unauthorized
- `403`: Forbidden
- `404`: Not Found
- `409`: Conflict
- `422`: Validation Error
- `429`: Too Many Requests
- `500`: Internal Server Error

---

[API](https://skmtc.dev/agentstack/apis/agentstack-core-api.md) · [All operations](https://skmtc.dev/agentstack/apis/agentstack-core-api/llms.txt) · [OpenAPI document](https://skmtc.dev/agentstack/apis/agentstack-core-api/revisions/79f4a4dd8813?raw)
