> ## 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.

# Create Review

> Endpoint to create a review on behalf of a customer who purchased a product

```bash Request Example theme={null}
curl --request POST 'https://api.mayar.id/hl/v2/reviews/create' \
--header 'Authorization: Bearer Paste-Your-API-Key-Here' \
--header 'Content-Type: application/json' \
--data-raw '{
    "paymentLinkId": "e2b3f5d5-0c62-47ba-8a01-6c1c209e0f77",
    "customerEmail": "budi.santoso@example.com",
    "rating": 5,
    "message": "Materinya jelas dan mudah dipahami, terima kasih!",
    "contentReview": [
        {
            "id": "d4e5f6a7-b8c9-4012-d345-6789abcdef01",
            "type": "image"
        }
    ]
}'
```

```json Response Example 200 theme={null}
{
    "statusCode": 200,
    "messages": "success",
    "data": {
        "id": "11f4d767-4d88-41ff-8777-06564d906fe7",
        "rating": 5,
        "message": "Materinya jelas dan mudah dipahami, terima kasih!",
        "paymentLinkId": "e2b3f5d5-0c62-47ba-8a01-6c1c209e0f77",
        "customerId": "22eb6224-c20a-4bc2-9b99-13b21e7048c6",
        "userId": "348e083d-315a-4e5c-96b1-5a2a98c48413",
        "status": "ACTIVE",
        "createdAt": 1767063610103,
        "updatedAt": 1767063610103
    }
}
```

Endpoint:

```Production Production theme={null}
https://api.mayar.id/hl/v2/reviews/create
```

```Sandbox Sandbox theme={null}
https://api.mayar.io/hl/v2/reviews/create
```

## Authorization

**Authorization** `string` *required*

Example:

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

## Request Body

**paymentLinkId** `string` *required*

ID of the payment link / product being reviewed. 3–100 characters.

**customerEmail** `string` *required*

Email of the customer leaving the review. Must be a valid email (5–100 characters) belonging to a
customer who has paid for the product.

**rating** `number` *required*

Rating value. Integer between 1 and 5.

**message** `string`

Optional review message. 1–2000 characters.

**contentReview** `array of object`

Optional list of media attachments (images and/or videos). Maximum 10 entries.

**contentReview\.id** `string`

Identifier of the uploaded file to attach.

**contentReview\.type** `string`

Media type of the attachment. One of `image` or `video`.

**contentReview\.multipleFileId** `string`

Identifier of the underlying file record, when applicable.

## Response

Successful Response

### Main Structure (Root)

**statusCode** `integer`

Status code returned by the API.

**messages** `string`

Status message that describes the status code. `"success"` on success, `"failed"` when the
request body fails validation.

**data** `object`

The created review record. When `messages` is `"failed"`, this holds the validation detail
instead.

### data Structure (Object)

**id** `string`

Unique review ID.

**rating** `number`

Rating value submitted by the customer.

**message** `string`

Review message submitted by the customer.

**paymentLinkId** `string`

Payment link ID associated with the review.

**customerId** `string`

Unique customer identifier associated with the review.

**userId** `string`

Unique user ID associated with the payment link owner.

**status** `string`

Current review status. New reviews are created with status `ACTIVE`.

**createdAt** `number`

Unix timestamp in milliseconds indicating when the review was created.

**updatedAt** `number`

Unix timestamp in milliseconds indicating when the review was last updated.

## Errors

**200 Validation Failed** `object`

Returned with `messages` set to `"failed"` and `data` holding the validation detail when the
request body is invalid.

**404 Not Found** `object`

Returned with `messages` set to `"Produk tidak ditemukan"` when the product does not exist or is
not owned by the authenticated merchant.

**403 Forbidden** `object`

Returned with `messages` set to `"Anda belum pernah membeli produk ini"` when the customer has no
paid transaction for the product.

**409 Conflict** `object`

Returned with `messages` set to `"Anda sudah memberikan ulasan untuk produk ini, jika ingin
    mengedit ulasan, silahkan gunakan fitur edit ulasan"` when the customer has already reviewed the
product.

**500 Server Error** `object`

Returned with `messages` set to `"Gagal menambahkan ulasan"` or `"Terjadi kesalahan saat
    menambahkan ulasan"` when the review cannot be saved.


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