---
title: "Apply deposit to an invoice"
method: POST
path: "/v1/deposits/{depositId}/apply"
tags: ["Deposits"]
---

# Apply deposit to an invoice

`POST /v1/deposits/{depositId}/apply`

## Request

- Base URL: `https://api.frihet.io`
- URL: `https://api.frihet.io/v1/deposits/{depositId}/apply`
- Auth: API key in header `X-API-Key`

Apply all or part of a deposit's remaining balance to a specific invoice.
Returns an error if the requested amount exceeds the remaining balance or
if the deposit has already been applied to the given invoice.

## Path parameters

- `depositId` string, required

## Request body

- object
  - `invoiceId` string, required: ID of the invoice to apply the deposit to
  - `invoiceNumber` string, required: Invoice number (for audit trail)
  - `amount` number, required: Amount to apply (must be positive and not exceed remaining balance)

## Response `200`

Deposit applied successfully

- object
  - `success` boolean
  - `depositId` string
  - `appliedAmount` number
  - `remainingBalance` number
  - `status` 'active' | 'partially_applied' | 'fully_applied'

## Other responses

- `400`: Bad request - invalid parameters or request body
- `401`: Authentication required or invalid API key
- `404`: Resource not found
- `429`: Rate limit exceeded (100 requests per minute)
- `500`: Internal server error

---

[API](https://skmtc.dev/frihet/apis/frihet-api.md) · [All operations](https://skmtc.dev/frihet/apis/frihet-api/llms.txt) · [OpenAPI document](https://skmtc.dev/frihet/apis/frihet-api/revisions/3dd37f6a72d1?raw)
