# Invoice Endpoints {#invoice-endpoints}


API endpoints for invoice management, estimates, and payments.


## Invoices {#invoices}



### List Invoices {#list-invoices}


```http
GET /api/invoices?take=20&skip=0&relations[]=toContact&relations[]=fromOrganization
Authorization: Bearer {token}
```

**Response (200 OK):**

```json
{
  "items": [
    {
      "id": "...",
      "invoiceNumber": "INV-001",
      "invoiceDate": "2024-01-15T00:00:00.000Z",
      "dueDate": "2024-02-15T00:00:00.000Z",
      "currency": "USD",
      "discountValue": 10,
      "discountType": "PERCENT",
      "tax": 7.5,
      "tax2": 0,
      "totalValue": 5000,
      "status": "SENT",
      "sentTo": "client@example.com",
      "isEstimate": false,
      "organizationId": "...",
      "toContactId": "..."
    }
  ],
  "total": 25
}
```


### Create Invoice {#create-invoice}


```http
POST /api/invoices
Authorization: Bearer {token}
Content-Type: application/json

{
  "invoiceNumber": "INV-002",
  "invoiceDate": "2024-01-15",
  "dueDate": "2024-02-15",
  "currency": "USD",
  "discountValue": 10,
  "discountType": "PERCENT",
  "tax": 7.5,
  "totalValue": 5000,
  "toContactId": "contact-uuid",
  "organizationId": "org-uuid",
  "invoiceItems": [
    {
      "description": "Development services",
      "quantity": 40,
      "price": 125,
      "totalValue": 5000,
      "applyTax": true,
      "applyDiscount": true
    }
  ]
}
```


### Send Invoice {#send-invoice}


```http
PUT /api/invoices/{id}/email
Authorization: Bearer {token}
Content-Type: application/json

{
  "email": "client@example.com"
}
```


### Invoice Statuses {#invoice-statuses}


| Status           | Description              |
| ---------------- | ------------------------ |
| `DRAFT`          | Created but not sent     |
| `SENT`           | Sent to client           |
| `VIEWED`         | Viewed by client         |
| `ACCEPTED`       | Accepted by client       |
| `PAID`           | Payment received         |
| `PARTIALLY_PAID` | Partial payment received |
| `OVERDUE`        | Past due date            |
| `VOID`           | Cancelled/voided         |


## Estimates {#estimates}


Estimates use the same endpoint with `isEstimate: true`:

```http
POST /api/invoices
Content-Type: application/json

{
  "isEstimate": true,
  "invoiceNumber": "EST-001",
  ...
}
```


### Convert Estimate to Invoice {#convert-estimate-to-invoice}


```http
PUT /api/invoices/{estimate-id}/convert
Authorization: Bearer {token}
```


## Payments {#payments}



### List Payments {#list-payments}


```http
GET /api/payment?where[invoiceId]={invoice-id}
Authorization: Bearer {token}
```


### Create Payment {#create-payment}


```http
POST /api/payment
Authorization: Bearer {token}
Content-Type: application/json

{
  "invoiceId": "invoice-uuid",
  "paymentDate": "2024-02-10",
  "amount": 2500,
  "currency": "USD",
  "paymentMethod": "BANK_TRANSFER",
  "note": "Partial payment",
  "organizationId": "org-uuid"
}
```


### Payment Methods {#payment-methods}


| Method          | Description                   |
| --------------- | ----------------------------- |
| `BANK_TRANSFER` | Wire/bank transfer            |
| `CASH`          | Cash payment                  |
| `CHEQUE`        | Check payment                 |
| `CREDIT_CARD`   | Credit card                   |
| `DEBIT`         | Debit card                    |
| `ONLINE`        | Online payment (PayPal, etc.) |


## Related Pages {#related-pages}


- [Expense Endpoints](https://sourcey-gauzy.pages.dev/api/expense-endpoints/index.md) — expense and income tracking
- [API Overview](https://sourcey-gauzy.pages.dev/api/overview/index.md) — general API information
