## POST /api/v2/billing/invoices/{id}/actions/resend-peppol

**Request a Peppol invoice copy**

Send a copy of an unpaid e-invoice again through Peppol, to the recipient the original went to. Read `GET /api/v2/billing/invoices/{id}/email-info` first. `peppol.delivery.resend.allowed` must be true. Send its `peppol.delivery.recipient.id` and `peppol.delivery.transactionId` with a new `requestId`. The copy is the same invoice. It creates no new invoice and does not change future delivery settings. Follow the copy in `peppol.delivery.attempts` on the same delivery history. For a paid invoice, use `POST /api/v2/billing/invoices/{id}/actions/resend-email` instead.

### 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
- Scope: `write:billing`
- `Content-Type`: application/json

### Parameters

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

### Request Body

- `requestId` (string, required): A UUID you create for this copy. Reuse it to retry the same request.
- `recipientId` (string, required): `peppol.delivery.recipient.id` from the delivery history.
- `transactionId` (string, required, nullable): `peppol.delivery.transactionId` from the delivery history. Null when it is null there.

### Request Examples

#### Request a copy

```bash
curl -X POST "https://cloud.hostup.se/api/v2/billing/invoices/inv_01hxa3b4c5d6e7f8g9h0j1k2m3/actions/resend-peppol" \
  -H "Authorization: Bearer $HOSTUP_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "requestId": "3f2b6c1e-8d4a-4b7f-9c2e-5a1d0f6e7b8c",
    "recipientId": "0007:0000000000",
    "transactionId": "4b1f7c2e-9a3d-4e6f-8b2a-1c5d7e9f0a3b"
  }'
```

```json
{
  "requestId": "3f2b6c1e-8d4a-4b7f-9c2e-5a1d0f6e7b8c",
  "recipientId": "0007:0000000000",
  "transactionId": "4b1f7c2e-9a3d-4e6f-8b2a-1c5d7e9f0a3b"
}
```

### Response Schema

- `requestId` (string, required)
- `status` (string, required)
  Allowed values: queued, sending, sent, failed, unknown
- `queuedAt` (string, required)

### Responses

#### 200 - The copy request, new or the earlier one with the same `requestId`.
```json
{
  "requestId": "3f2b6c1e-8d4a-4b7f-9c2e-5a1d0f6e7b8c",
  "status": "queued",
  "queuedAt": "2026-09-16T14:02:11.000Z"
}
```

#### 400 - `invalid_request`: `requestId` must be a UUID. `recipientId` and `transactionId` must be the values from the delivery history.
```json
{
  "type": "https://developer.hostup.se/errors/invalid_request",
  "title": "Validation failed",
  "status": 400,
  "detail": "The request body failed validation.",
  "code": "invalid_request",
  "instance": "/api/v2/resource",
  "requestId": "req_01hxa3b4c5d6e7f8g9h0j1k2m3",
  "timestamp": "2026-04-27T12:34:56.000Z",
  "errors": [
    {
      "pointer": "/name",
      "detail": "`name` is required.",
      "code": "invalid_request"
    }
  ]
}
```

#### 401 - Authentication is required.
```json
{
  "type": "https://developer.hostup.se/errors/invalid_request",
  "title": "Validation failed",
  "status": 400,
  "detail": "The request body failed validation.",
  "code": "invalid_request",
  "instance": "/api/v2/resource",
  "requestId": "req_01hxa3b4c5d6e7f8g9h0j1k2m3",
  "timestamp": "2026-04-27T12:34:56.000Z",
  "errors": [
    {
      "pointer": "/name",
      "detail": "`name` is required.",
      "code": "invalid_request"
    }
  ]
}
```

#### 403 - Forbidden. The caller lacks a required scope or does not own the resource.
```json
{
  "type": "https://developer.hostup.se/errors/forbidden",
  "title": "Forbidden",
  "status": 403,
  "detail": "The caller lacks a required scope or does not own the resource.",
  "code": "forbidden",
  "instance": "/api/v2/resource",
  "requestId": "req_01hxa3b4c5d6e7f8g9h0j1k2m3",
  "timestamp": "2026-04-27T12:34:56.000Z"
}
```

#### 404 - `invoice_not_found`: no such invoice on this account.
```json
{
  "type": "https://developer.hostup.se/errors/invalid_request",
  "title": "Validation failed",
  "status": 400,
  "detail": "The request body failed validation.",
  "code": "invalid_request",
  "instance": "/api/v2/resource",
  "requestId": "req_01hxa3b4c5d6e7f8g9h0j1k2m3",
  "timestamp": "2026-04-27T12:34:56.000Z",
  "errors": [
    {
      "pointer": "/name",
      "detail": "`name` is required.",
      "code": "invalid_request"
    }
  ]
}
```

#### 409 - `peppol_invoice_not_unpaid`: the invoice is no longer unpaid. `invoice_not_ready`: the invoice is still being finalized. `peppol_delivery_changed`: `recipientId` or `transactionId` no longer match the delivery history. Other `peppol_` codes mean a copy cannot be requested now. Read the delivery history again before retrying.
```json
{
  "type": "https://developer.hostup.se/errors/invalid_request",
  "title": "Validation failed",
  "status": 400,
  "detail": "The request body failed validation.",
  "code": "invalid_request",
  "instance": "/api/v2/resource",
  "requestId": "req_01hxa3b4c5d6e7f8g9h0j1k2m3",
  "timestamp": "2026-04-27T12:34:56.000Z",
  "errors": [
    {
      "pointer": "/name",
      "detail": "`name` is required.",
      "code": "invalid_request"
    }
  ]
}
```

#### 429 - `peppol_rate_limited`: too many copies were requested for this invoice. Try again later.
```json
{
  "type": "https://developer.hostup.se/errors/invalid_request",
  "title": "Validation failed",
  "status": 400,
  "detail": "The request body failed validation.",
  "code": "invalid_request",
  "instance": "/api/v2/resource",
  "requestId": "req_01hxa3b4c5d6e7f8g9h0j1k2m3",
  "timestamp": "2026-04-27T12:34:56.000Z",
  "errors": [
    {
      "pointer": "/name",
      "detail": "`name` is required.",
      "code": "invalid_request"
    }
  ]
}
```

#### 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"
}
```

#### 503 - The copy could not be confirmed (`peppol_result_unknown` or another `peppol_` code). Read the delivery history before trying again.
```json
{
  "type": "https://developer.hostup.se/errors/invalid_request",
  "title": "Validation failed",
  "status": 400,
  "detail": "The request body failed validation.",
  "code": "invalid_request",
  "instance": "/api/v2/resource",
  "requestId": "req_01hxa3b4c5d6e7f8g9h0j1k2m3",
  "timestamp": "2026-04-27T12:34:56.000Z",
  "errors": [
    {
      "pointer": "/name",
      "detail": "`name` is required.",
      "code": "invalid_request"
    }
  ]
}
```
