# Coupons

## Coupons

<mark style="color:blue;">`GET`</mark> `https://api.woowup.com/apiv3/coupons` &#x20;

Retrieve a list of redeemed coupons  by assign\_date descending

#### Path Parameters

| Name   | Type   | Description                                                                |
| ------ | ------ | -------------------------------------------------------------------------- |
| status | string | "available", "assigned", "pending", "cancelled", "used"                    |
| from   | string | Min assign\_date of the returned coupons. Format yyyy-mm-dd hh:mm:ss (UTC  |
| to     | string | Max assign\_date of the returned coupons. Format yyyy-mm-dd hh:mm:ss (UTC) |
| page   | number | Number of the page returned. Default 0                                     |
| limit  | number | Items per page returned. Default 25, MAX 100                               |

{% tabs %}
{% tab title="200 " %}

```
[
    {
        "id": 1234,
        "code": "ASE34AWVS21",
        "assign_date": "2017-05-10 14:32:12",
        "status": "assigned",
        "user": {
            "userapp_id": 1234,
            "user_id": 1234,
            "app_id": 123,
            "service_uid": "98765",
            "email": "user@email.com",
            "first_name": "John",
            "last_name": "Doe",
            "telephone": "5411987654321",
            "birthday": "1986-08-13",
            "gender": "M",
            "tags": [],
            "points": 0,
            "points_pending": 0,
            "customform": {
                "user_id": "98765"
            },
            "club_inscription_date": "2017-01-03",
            "blocked": false,
            "notes": "user notes",
            "mailing_enabled": true,
            "mailing_enabled_reason": null
        },
        "benefit": {
            "id": 1234,
            "slug": "benefit-1-title",
            "title": "Benefit 1 title",
            "description": "Benefit 1 description",
            "terms": "Terms and condition",
            "on_assign_msg": "After assign message",
            "status": 1,
            "app_id": 123,
            "startdate": "2017-04-20 14:51:00",
            "enddate": "2017-05-17 19:34:25",
            "action_id": 5678,
            "image_url": "https://api.woowup.com/image.png"
        }
    },
    {
        "id": 1235,
        "code": "ASE34AWVS22",
        "assign_date": null,
        "status": "available",
        "user": null,
        "benefit": {
            "id": 1234,
            "slug": "benefit-1-title",
            "title": "Benefit 1 title",
            "description": "Benefit 1 description",
            "terms": "Terms and condition",
            "on_assign_msg": "After assign message",
            "status": 1,
            "app_id": 123,
            "startdate": "2017-04-20 14:51:00",
            "enddate": "2017-05-17 19:34:25",
            "action_id": 5678,
            "image_url": "https://api.woowup.com/image.png"
        }
    }
]
```

{% endtab %}

{% tab title="400 " %}

```
```

{% endtab %}

{% tab title="500 " %}

```
```

{% endtab %}
{% endtabs %}

**Example**

```
curl -X GET \
  'https://api.woowup.com/apiv3/coupons?status=assigned&limit=100&page=0&from=2017-01-01%2000%3A00%3A00&to=2017-05-31%2023%3A59%3A59' \
  -H 'accept: application/json' \
  -H 'authorization: Basic XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' \
  -H 'cache-control: no-cache'
```

## Update Coupon

<mark style="color:orange;">`PUT`</mark> `https://api.woowup.com/apiv3/coupons/:code`&#x20;

#### Request Body

| Name   | Type   | Description |
| ------ | ------ | ----------- |
| status | string |             |

{% tabs %}
{% tab title="200 " %}

```
[
    {
        "id": 1234,
        "code": "abcdefg",
        "assign_date": "2017-05-10 14:32:12",
        "status": "cancelled",
        "user": {
            "userapp_id": 1234,
            "user_id": 1234,
            "app_id": 123,
            "service_uid": "98765",
            "email": "user@email.com",
            "first_name": "John",
            "last_name": "Doe",
            "telephone": "5411987654321",
            "birthday": "1986-08-13",
            "gender": "M",
            "tags": [],
            "points": 0,
            "points_pending": 0,
            "customform": {
                "user_id": "98765"
            },
            "club_inscription_date": "2017-01-03",
            "blocked": false,
            "notes": "user notes",
            "mailing_enabled": true,
            "mailing_enabled_reason": null
        },
        "benefit": {
            "id": 1234,
            "slug": "benefit-1-title",
            "title": "Benefit 1 title",
            "description": "Benefit 1 description",
            "terms": "Terms and condition",
            "on_assign_msg": "After assign message",
            "status": 1,
            "app_id": 123,
            "startdate": "2017-04-20 14:51:00",
            "enddate": "2017-05-17 19:34:25",
            "action_id": 5678,
            "image_url": "https://api.woowup.com/image.png"
        }
    }
]
```

{% endtab %}

{% tab title="400 " %}

```
{
    "payload": {
        "errors": [
            "/status: Value \"qwerty\" is not one of: [\"available\",\"assigned\",\"pending\",\"cancelled\",\"used\"]"
        ]
    },
    "message": "bad request",
    "code": "bad_request",
    "time": "42ms"
}
```

{% endtab %}

{% tab title="500 " %}

```
{
    "payload": [],
    "message": "Can't update coupon",
    "code": "internal_error",
    "time": "82ms"
}
```

{% endtab %}
{% endtabs %}

{% hint style="success" %}
{ \
&#x20; "$schema": "<http://json-schema.org/draft-04/schema#>", \
&#x20; "description": "A representation of a coupon", \
&#x20; "type": "object", \
&#x20; "required": \["status"], \
&#x20; "properties": { \
&#x20;   "status": { \
&#x20;      "type": "string",  \
&#x20;      "enum": \["available", "assigned", "pending", "cancelled", "used"] \
&#x20;   }\
&#x20;}
{% endhint %}

```
curl -X PUT \
  https://api.woowup.com/apiv3/coupons/abcdefg \
  -H 'accept: application/json' \
  -H 'authorization: Basic XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' \
  -d '{
	"status": "cancelled"
}'
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://woowup-docs.gitbook.io/woowup-developer-docs/api/coupons.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
