## POST /api/v2/billing/invoices/{id}/actions/reissue-in-currency

**Reissue an invoice in EUR**

Switch the account to EUR and replace its open renewal invoices with EUR invoices for the same periods. The new invoices can be paid by SEPA bank transfer. This is for customers outside Sweden with SEK invoices. Check `actions.canReissueInCurrency` on `GET /api/v2/billing/invoices/{id}` first. Send `dryRun: true` first to see every open invoice the switch affects and any blockers. Nothing changes on a dry run. The real call goes through only when every open invoice can be reissued and no order is pending. It changes the account currency for all future invoices. When the account is not in EUR yet, it uses one of the account's monthly currency changes (`changeQuota`). Each original invoice is cancelled and replaced at once. The response lists each cancelled invoice with its replacement.

### Related Endpoints

- `POST /api/v2/billing/invoices/{id}/actions/pay`: Pay an invoice with a saved card
- `POST /api/v2/billing/invoices/{id}/actions/cancel`: Cancel an invoice
- `POST /api/v2/billing/invoices/{id}/actions/apply-credit`: Pay an invoice with account credit

### Headers

- `Authorization`: Bearer $HOSTUP_API_KEY
- Scopes: `write:billing`, `write:account`
- `Content-Type`: application/json

### Parameters

- `id` (path, string, required): Public invoice ID from `GET /api/v2/billing/invoices` (`inv_…`). Example: `inv_01hxa3b4c5d6e7f8g9h0j1k2m3`

### Request Body

- `currencyCode` (string, required): Target currency. Only `EUR`, the currency SEPA bank transfer uses.
  Allowed values: EUR
- `dryRun` (boolean, optional): Return the plan without changing anything. Default false.

### Request Examples

#### Preview the switch

```bash
curl -X POST "https://cloud.hostup.se/api/v2/billing/invoices/inv_01hxa3b4c5d6e7f8g9h0j1k2m3/actions/reissue-in-currency" \
  -H "Authorization: Bearer $HOSTUP_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "currencyCode": "EUR",
    "dryRun": true
  }'
```

```json
{
  "currencyCode": "EUR",
  "dryRun": true
}
```

#### Switch to EUR and reissue

```bash
curl -X POST "https://cloud.hostup.se/api/v2/billing/invoices/inv_01hxa3b4c5d6e7f8g9h0j1k2m3/actions/reissue-in-currency" \
  -H "Authorization: Bearer $HOSTUP_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "currencyCode": "EUR"
  }'
```

```json
{
  "currencyCode": "EUR"
}
```

### Response Schema

- `currencyCode` (string, required) Example: `EUR`
- `exchangeRate` (number, required, nullable): EUR per 1 SEK, used for `expectedAmount`. The replacement is priced from the product's EUR price. Its amount can differ. Example: `0.1`
- `allowed` (boolean, required): True when the real call would go through.
- `blockers` (array<object>, required)
- `blockers[].invoiceId` (string, required, nullable)
- `blockers[].invoiceNumber` (string, required, nullable)
- `blockers[].code` (string, required)
  Allowed values: account_country_not_eligible, invoice_not_unpaid, invoice_already_in_currency, invoice_partially_settled, invoice_peppol_delivered, invoice_order_backed, invoice_add_funds, invoice_usage_not_reissuable, invoice_domain_renewal, invoice_not_service_renewal, invoice_multiple_services, renewal_period_ended, currency_not_supported, pending_orders, rate_limited
- `blockers[].reason` (string, required)
- `changeQuota` (object, required)
- `changeQuota.remaining` (integer, required): Currency changes left this month. The switch uses one when the account is not in EUR yet.
- `changeQuota.resetAt` (string, required): When the monthly count resets.
- `invoices` (array<object>, required): Every open invoice the switch affects, the requested one first.
- `invoices[].id` (string, required)
- `invoices[].number` (string, required, nullable)
- `invoices[].amount` (number, required)
- `invoices[].currencyCode` (string, required)
- `invoices[].dueAt` (string, required, nullable)
- `invoices[].expectedAmount` (number, required, nullable)
- `invoices[].expectedCurrencyCode` (string, required)
- `invoices[].expectedDueAt` (string, required, nullable): The later of the original due date and seven days from today.
- `invoices[].actions` (object, required)
- `invoices[].actions.canReissueInCurrency` (object, required)
- `invoices[].actions.canReissueInCurrency.allowed` (boolean, required) Example: `true`
- `invoices[].actions.canReissueInCurrency.reason` (string, required, nullable) Example: `null`
- `invoices[].actions.canReissueInCurrency.code` (string, optional, nullable): A machine-readable code for why the action is blocked. Example: `pending_order`

### Responses

#### 200 - With `dryRun: true`: the plan. Otherwise: each cancelled invoice with its EUR replacement.
```json
{
  "currencyCode": "EUR",
  "exchangeRate": 0.1,
  "allowed": true,
  "blockers": [],
  "changeQuota": {
    "remaining": 2,
    "resetAt": "2026-10-01T00:00:00.000Z"
  },
  "invoices": [
    {
      "id": "inv_01hxa3b4c5d6e7f8g9h0j1k2m3",
      "number": "202681499",
      "amount": 708,
      "currencyCode": "SEK",
      "dueAt": "2026-09-10T00:00:00.000Z",
      "expectedAmount": 70.8,
      "expectedCurrencyCode": "EUR",
      "expectedDueAt": "2026-09-17T00:00:00.000Z",
      "actions": {
        "canReissueInCurrency": {
          "allowed": true,
          "reason": null,
          "code": null
        }
      }
    }
  ]
}
```

#### 400 - Invalid body. `currencyCode` must be `EUR` and `dryRun` a boolean. Other fields are rejected.
```json
{
  "type": "https://developer.hostup.se/errors/invalid_request",
  "title": "Invalid request",
  "status": 400,
  "detail": "Bank transfer invoices are issued in EUR; currencyCode must be \"EUR\".",
  "code": "invalid_request",
  "instance": "/api/v2/billing/invoices/inv_01hxa3b4c5d6e7f8g9h0j1k2m3/actions/reissue-in-currency",
  "errors": [
    {
      "pointer": "/currencyCode",
      "detail": "Bank transfer invoices are issued in EUR; currencyCode must be \"EUR\".",
      "code": "invalid_currency"
    }
  ]
}
```

#### 401 - Unauthorized. Authentication is required.
```json
{
  "type": "https://developer.hostup.se/errors/unauthorized",
  "title": "Unauthorized",
  "status": 401,
  "detail": "Authentication is required.",
  "code": "unauthorized",
  "instance": "/api/v2/resource",
  "requestId": "req_01hxa3b4c5d6e7f8g9h0j1k2m3",
  "timestamp": "2026-04-27T12:34:56.000Z"
}
```

#### 403 - `delegated_access_forbidden`: a user with delegated access cannot change the account currency.
```json
{
  "type": "https://developer.hostup.se/errors/delegated_access_forbidden",
  "title": "Forbidden",
  "status": 403,
  "detail": "Delegated access users cannot change account currency.",
  "code": "delegated_access_forbidden",
  "instance": "/api/v2/billing/invoices/inv_01hxa3b4c5d6e7f8g9h0j1k2m3/actions/reissue-in-currency"
}
```

#### 404 - Not found. The resource does not exist or is not owned by the caller; `code` is `invoice_not_found`.
```json
{
  "type": "https://developer.hostup.se/errors/invoice_not_found",
  "title": "Not found",
  "status": 404,
  "detail": "The requested resource could not be found.",
  "code": "invoice_not_found",
  "instance": "/api/v2/resource",
  "requestId": "req_01hxa3b4c5d6e7f8g9h0j1k2m3",
  "timestamp": "2026-04-27T12:34:56.000Z"
}
```

#### 409 - Blocked. `invoice_reissue_blocked`: an open invoice cannot be reissued. `detail` gives the first reason. Send `dryRun: true` to see every blocker. `pending_orders`: finish or cancel the open orders first.
```json
{
  "type": "https://developer.hostup.se/errors/invoice_reissue_blocked",
  "title": "Invoice cannot be reissued",
  "status": 409,
  "detail": "This invoice belongs to a pending order or plan change. Cancel that order and place it again after changing your account currency.",
  "code": "invoice_reissue_blocked",
  "instance": "/api/v2/billing/invoices/inv_01hxa3b4c5d6e7f8g9h0j1k2m3/actions/reissue-in-currency"
}
```

#### 429 - `rate_limited`: the account has used its currency changes for this month. `Retry-After` gives the wait in seconds when known.
```json
{
  "type": "https://developer.hostup.se/errors/rate_limited",
  "title": "Rate limited",
  "status": 429,
  "detail": "The limit for currency changes this month is reached (2/2). Try again after 2026-10-01.",
  "code": "rate_limited",
  "instance": "/api/v2/billing/invoices/inv_01hxa3b4c5d6e7f8g9h0j1k2m3/actions/reissue-in-currency"
}
```

#### 500 - Internal error. Retry later or contact support if the issue persists.
```json
{
  "type": "https://developer.hostup.se/errors/internal_error",
  "title": "Internal server error",
  "status": 500,
  "detail": "An unexpected error occurred. Retry later or contact support if the issue persists.",
  "code": "internal_error",
  "instance": "/api/v2/resource",
  "requestId": "req_01hxa3b4c5d6e7f8g9h0j1k2m3",
  "timestamp": "2026-04-27T12:34:56.000Z"
}
```

#### 502 - `upstream_failed`: the currency settings or the currency change failed. Nothing changed. `upstream_renewal_regeneration_failed`: the account currency changed but at least one invoice was not replaced. `detail` says for each invoice whether the original was cancelled or is still payable by card. A cancelled original has nothing to pay until Hostup issues the replacement.
```json
{
  "type": "https://developer.hostup.se/errors/upstream_renewal_regeneration_failed",
  "title": "Replacement invoice could not be issued",
  "status": 502,
  "detail": "Your account currency is now EUR. Invoice #202681499 was cancelled, but the new invoice could not be issued. Our team has been notified and will issue it; there is nothing to pay until then.",
  "code": "upstream_renewal_regeneration_failed",
  "instance": "/api/v2/billing/invoices/inv_01hxa3b4c5d6e7f8g9h0j1k2m3/actions/reissue-in-currency"
}
```
