> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mayar.id/llms.txt
> Use this file to discover all available pages before exploring further.

# Edit Invoice

> Endpoint used to edit an invoice that has been created

```bash Request Example theme={null}
curl --request POST 'https://api.mayar.id/hl/v2/invoices/6f8c19ff-5b97-4792-aa89-d2a12797b356/update' \
--header 'Authorization: Bearer Paste-Your-API-Key-Here' \
--header 'Content-Type: application/json' \
--data-raw '{
        "id": "6f8c19ff-5b97-4792-aa89-d2a12797b356",
        "description": "Invoice yang sudah diedit",
        "items": [
            {
                "quantity": 2,
                "rate": 55000,
                "description": "Paket layanan B"
            }
        ]
    }'
```

```json Response Example 200 theme={null}
{
    "statusCode": 200,
    "messages": "success",
    "data": {
        "id": "6f8c19ff-5b97-4792-aa89-d2a12797b356",
        "link": "https://testingmayar.myr.id/invoices/ibzfrf4880"
    }
}
```

Endpoint:

```Production Production theme={null}
https://api.mayar.id/hl/v2/invoices/{uuId}/update
```

```Sandbox Sandbox theme={null}
https://api.mayar.io/hl/v2/invoices/{uuId}/update
```

> [!NOTE]
>
> The invoice to update is selected by the `id` field in the **request body**, not
> by the `{uuId}` segment in the URL path. The path segment is cosmetic and is
> ignored by the API — always send the target invoice `id` in the body.

## Authorization

**Authorization** `string` *required*

Example:

`Authorization | Bearer Paste-Your-API-Key-Here`

## Request Body

**id** `string\<uuid\>` *required*

A unique identifier obtained when creating an invoice. This selects the invoice
to update (the `{uuId}` URL segment is ignored).

Example:

`6f8c19ff-5b97-4792-aa89-d2a12797b356`

**items** `array`

List of invoice items.

**items\[].quantity** `number`

Quantity of the item.

**items\[].rate** `number`

Price per item.

**items\[].description** `string`

Description of the item.

**description** `string`

Description or notes related to the invoice.

**expiredAt** `string`

Invoice expiration time in ISO 8601 format (UTC).

**notes** `string`

Additional notes for the invoice.

**tax** `integer`

Tax amount applied to the invoice.

**paymentMethod** `string`

Restrict the invoice to a specific payment method.

> [!NOTE]
>
> `paymentMethod` determines the payment code returned by the API (for example a
> VA number or a QRIS payload) for that specific method. The Mayar checkout page
> link (`link`) still follows the payment methods configured in your Mayar
> settings.

**cashtag** `string`

Cashtag associated with the invoice.

**extraData** `object`

Additional custom data attached to the invoice.

## Response

Successful Response

### Main Structure (Root)

**statusCode** `integer`

Status code form API.

**messages** `string`

Status message that describes the status code.

**data** `object`

The updated invoice data.

### data Structure (Object)

**id** `string\<uuid\>`

Unique invoice ID.

**link** `string`

The URL that customers can access to open the invoice.

### Errors

**401 Unauthorized** `object`

Returned when the API key is missing or invalid:
`{ "statusCode": 401, "messages": "Unauthorized" }`.

**404 Not Found** `object`

Returned when no invoice matches the provided `id`:
`{ "statusCode": 404, "messages": "Invoice not found" }`.

**409 Conflict** `object`

Returned when the invoice has already been paid and can no longer be edited:
`{ "statusCode": 409, "messages": "Transaction already paid. Cannot edit invoice." }`.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.