> ## 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 Digital Product

> Endpoint used to edit a digital product

```bash Request Example theme={null}
curl --request POST 'https://api.mayar.id/hl/v2/products/digital-product/6894b1b2-f303-423b-a6b6-93e230e1d393/update' \
--header 'Authorization: Bearer Paste-Your-API-Key-Here' \
--header 'Content-Type: application/json' \
--data-raw '{
        "id": "6894b1b2-f303-423b-a6b6-93e230e1d393",
        "name": "E-Book Panduan Bisnis Buat Pemula Edisi Revisi",
        "description": "Panduan lengkap memulai bisnis online",
        "amount": 85000,
        "redirectUrl": "https://example.com/ebook-download",
        "notes": "diskon-50",
        "expiredAt": "2026-06-15T12:00:00.000Z"
    }'
```

```json Response Example 200 theme={null}
{
    "statusCode": 200,
    "messages": "success",
    "data": {
        "id": "6894b1b2-f303-423b-a6b6-93e230e1d393",
        "link": "https://testingmayar.myr.id/catalog/E-Book-Panduan-Bisnis-Buat-Pemula"
    }
}
```

Endpoint:

```Production Production theme={null}
https://api.mayar.id/hl/v2/products/digital-product/{id}/update
```

```Sandbox Sandbox theme={null}
https://api.mayar.io/hl/v2/products/digital-product/{id}/update
```

> [!NOTE]
>
> The product to edit is identified by the `id` field in the request body, not by
> the `{id}` segment in the URL path.

## Authorization

**Authorization** `string` *required*

Example:

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

## Request Body

**id** `string` *required*

Unique identifier of the digital product to edit. This is read from the request
body.

**name** `string`

Digital product name.

**description** `string`

Digital product description.

**amount** `integer`

Digital product price amount.

**crossoutPrice** `integer`

Crossed-out price displayed as the original price.

**redirectUrl** `string`

URL where the customer will be redirected after completing payment.

**notes** `string`

Additional notes for the digital product.

**expiredAt** `string | datetime`

Product expiration date in ISO 8601 format.

## Response

Successful Response

### Main Structure (Root)

**statusCode** `integer`

Status code from API.

**messages** `string`

Status message that describes the status code.

**data** `object`

The updated digital product data.

### data Structure (Object)

**data.id** `string`

Unique identifier of the digital product.

**data.link** `string`

Public URL of the updated digital product.

### Errors

**200 OK (validation failed)** `object`

When the request body fails validation, this endpoint still responds with HTTP
`200` but sets `messages` to `failed` and returns the validator errors in
`data`: `{ "statusCode": 200, "messages": "failed", "data": { ... } }`.

**401 Unauthorized** `object`

Returned when the product does not belong to the authenticated account:
`{ "statusCode": 401, "messages": "Unauthorized" }`.

**404 Not Found** `object`

Returned when the product does not exist:
`{ "statusCode": 404, "messages": "Product not found" }`.


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