Skip to content

Generate a huggg voucher

Overview

POST /api/v2/hugggs/{hugggId}/voucher

This endpoint is used to generate a Voucher V1 for a huggg. If a voucher already exists for the huggg it will be returned. This endpoint is used for integration IDs: 1, 2, 3, 4, 5 and 6

Request

URL Parameters

Key Value Description
hugggId string The ID or shortcode of the huggg that you want a voucher for

Data Parameters

Key Value Description
segmentId string The segment ID to generate a voucher for
embed string[] Set to ['voucher.segment'] to embed the voucher segment

Examples

Generate a huggg voucher with segment

POST /api/v2/hugggs/{hugggId}/voucher/claimed

{
    "segmentId": "a_segment_id"
    "embed": ["voucher.segment"]
}

Response

The successful response returns a Huggg entity and an embedded Voucher V1 entity

The voucher code can be found in the path embedded.vouchers.[0].code.

HTTP/1.1 200 OK

{
    "data": {
        "id": "0681abdc-d98e-43dd-be45-fbd53e3c7074",
        "sender_id": "6f94e817-063f-43e0-b9d0-711ba8003232",
        "receiver_id": "",
        "created_at": "2020-08-20 11:58:00",
        "updated_at": "2020-08-20 11:58:39",
        "purchase_id": "9358edae-2f40-4b5f-b5b1-588f96341d4b",
        "code": "TEST_CODE",
        "expiry_date": "2020-09-19",
        "vid": "",
        "redeem_code": "ku6g4h",
        "shortcode": "jcsk2df4sphbgl7f",
        "reminder_sent": "",
        "type": "",
        "transaction_id": "60dc8ffb-36a0-4602-9544-1c6a8e41a43c",
        "account_id": null,
        "order_id": null,
        "deleted_at": null,
        "assigned_date": null,
        "assigned_client": null,
        "viewed_date": null,
        "viewed_client": null,
        "cover_image_url": null,
        "theme_id": "default",
        "sent_date": "2020-08-20 11:58:01",
        "message_id": "31cadffc-9489-42b4-acf3-51c87922749b",
        "voucher_id": "ee70ad0d-e9bd-11e9-8b1c-022d6c01c1ae",
        "redeemed_id": "",
        "is_expired": false,
        "hug_status": "sent",
        "status_code": "UC",
        "status": 12,
        "image_url": "https:\/\/cdn.huggg.me\/offers\/bfe45a1aa4bbe7a6b2c2fb05b2e2fa3d25e21ef1.png",
        "launch_url": "https:\/\/beta-launch.huggg.me\/jcsk2df4sphbgl7f",
        "theme_info": {
            "clientIds": ["UxUnGQ_oXXJXYyzw4uRmCOs_gn6FmaYH"],
            "name": "default",
            "type": "legacy",
            "label": "default",
            "id": "default"
        },
        "reminders_sent": []
    },
    "embedded": {
        "vouchers": [{
            "id": "ee70ad0d-e9bd-11e9-8b1c-022d6c01c1ae",
            "code": "TEST_CODE",
            "huggg_id": "0681abac-d98e-43dd-be45-fbd53e3c7074",
            "segment_id": "761299e9-f34d-11e8-80cd-02e611b48058",
            "expiry_date": "2021-10-31 23:59:00",
            "created_at": null,
            "updated_at": "2020-08-20 11:58:39"
        }]
    }
}