How do I manage coupons with the Amelia API
Use the coupons endpoints to validate coupon codes during booking, create new coupons, update existing coupons, retrieve coupon details, list coupons, and delete coupons.
You can find more API examples in the Amelia API Postman collection you can download here.
How do I validate a coupon with the Amelia API?
Use this endpoint to validate a coupon code for a specific entity and user, and to verify whether coupon usage limits are reached.
- Method: POST
- Path:
/coupons/validate
Base path
{{your_site_URL}}/wp-admin/admin-ajax.php?action=wpamelia_api&call=/api/v1
Authorization
- All Amelia endpoints use API key authorization via a request header named Amelia.
Required properties
- code (
string); coupon code - id (
integer); entity ID, for example service, event, or package ID - type (
string); entity type, possible values:service,package,event - user (
object); user data used to check per-user limits, includes firstName, lastName, and email
Optional properties
- count (
integer); number of recurring bookings, used when validating coupons for all recurring bookings
Example
Request
curl --location 'https://example-site.com/wp-admin/admin-ajax.php?action=wpamelia_api&call=/api/v1/coupons/validate' \
--header 'Content-Type: application/json' \
--header 'Amelia: YOUR_API_KEY' \
--data-raw '{
"code": "SPRING10",
"id": 1,
"type": "service",
"user": {
"firstName": "Jordan",
"lastName": "Reed",
"email": "jordan.reed@example.test"
},
"count": 1
}'
Response
{
"message": "Successfully retrieved coupon.",
"data": {
"coupon": {
"id": 5,
"code": "SPRING10",
"discount": 0,
"deduction": 10,
"limit": 100,
"customerLimit": 2,
"used": 0,
"notificationInterval": 0,
"notificationRecurring": false,
"status": "visible",
"serviceList": [],
"eventList": [],
"expirationDate": "2026-05-06"
},
"limit": 2
}
}
How do I add a coupon with the Amelia API?
Use this endpoint to create a new coupon and define its usage limits, discount settings, and the services, events, or packages it applies to.
- Method: POST
- Path:
/coupons
Base path
{{your_site_URL}}/wp-admin/admin-ajax.php?action=wpamelia_api&call=/api/v1
Authorization
- All Amelia endpoints use API key authorization via a request header named Amelia.
Required properties
- code (
string); coupon code - limit (
integer); usage limit of the coupon
Other properties
- discount (
integer); percentage discount - deduction (
float); fixed amount deduction - customerLimit (
integer); limit per customer - notificationInterval (
integer); number of approved bookings after which a coupon is sent in a notification - notificationRecurring (
boolean); whether notificationInterval repeats, default value isfalse - status (
string); possible values:visible,hidden - services (
array); array of service IDs - events (
array); array of event IDs - packages (
array); array of package IDs - expirationDate (
string); expiration date inYYYY-MM-DDformat
Example
Request
curl --location 'https://example-site.com/wp-admin/admin-ajax.php?action=wpamelia_api&call=/api/v1/coupons' \
--header 'Content-Type: application/json' \
--header 'Amelia: YOUR_API_KEY' \
--data '{
"code": "SPRING10",
"discount": 0,
"deduction": 10,
"limit": 20,
"customerLimit": 2,
"notificationInterval": 0,
"notificationRecurring": false,
"status": "visible",
"events": [80],
"services": [1],
"packages": [1],
"expirationDate": "2026-04-10"
}'
Response
{
"message": "New coupon successfully created.",
"data": {
"coupon": {
"id": 14,
"code": "SPRING10",
"discount": 0,
"deduction": 10,
"limit": 20,
"customerLimit": 2,
"used": 0,
"notificationInterval": 0,
"notificationRecurring": false,
"status": "visible",
"serviceList": [
{
"id": 1,
"name": "amelia service",
"description": "location address: %location_address%",
"color": "#1788FB",
"price": 20,
"deposit": 14,
"depositPayment": "fixed",
"depositPerPerson": true,
"pictureFullPath": null,
"pictureThumbPath": null,
"extras": [
{
"id": 17,
"name": "Extra 3",
"description": "Extra description",
"price": 20,
"maxQuantity": 1,
"position": 1,
"duration": 1800,
"serviceId": null,
"aggregatedPrice": false,
"translations": null
}
],
"coupons": [],
"position": 1,
"settings": "{\"payments\":{\"mollie\":{\"enabled\":true},\"paymentLinks\":{\"enabled\":true,\"changeBookingStatus\":false,\"redirectUrl\":null},\"onSite\":true,\"payPal\":{\"enabled\":true},\"stripe\":{\"enabled\":false},\"razorpay\":{\"enabled\":true},\"square\":{\"enabled\":true}},\"zoom\":{\"enabled\":true},\"lessonSpace\":{\"enabled\":true},\"activation\":{\"version\":\"6.7\"}}",
"fullPayment": true,
"minCapacity": 1,
"maxCapacity": 10,
"duration": 1800,
"timeBefore": 1800,
"timeAfter": 1800,
"bringingAnyone": true,
"show": true,
"aggregatedPrice": true,
"status": "visible",
"categoryId": 1,
"category": null,
"priority": [],
"gallery": [],
"recurringCycle": "all",
"recurringSub": "future",
"recurringPayment": 999,
"translations": null,
"minSelectedExtras": 1,
"mandatoryExtra": false,
"customPricing": "{\"enabled\":false,\"durations\":{\"3600\":{\"price\":30,\"rules\":[]},\"5400\":{\"price\":40,\"rules\":[]}}}",
"maxExtraPeople": null,
"limitPerCustomer": "{\"enabled\":false,\"numberOfApp\":1,\"timeFrame\":\"day\",\"period\":1,\"from\":\"bookingDate\"}"
}
],
"eventList": [
{
"id": 80,
"name": "event 123",
"description": "",
"color": "#1788FB",
"price": 330,
"deposit": 110,
"depositPayment": "fixed",
"depositPerPerson": true,
"pictureFullPath": null,
"pictureThumbPath": null,
"extras": [],
"coupons": [],
"position": null,
"settings": "{\"payments\":{\"paymentLinks\":{\"enabled\":true,\"changeBookingStatus\":false,\"redirectUrl\":null},\"onSite\":true,\"payPal\":{\"enabled\":false},\"stripe\":{\"enabled\":false},\"mollie\":{\"enabled\":false},\"razorpay\":{\"enabled\":false}},\"general\":{\"minimumTimeRequirementPriorToCanceling\":null,\"redirectUrlAfterAppointment\":null},\"zoom\":{\"enabled\":true},\"lessonSpace\":{\"enabled\":false}}",
"fullPayment": false,
"bookings": [
{
"id": 905,
"customerId": 46,
"customer": {
"id": 46,
"firstName": "Jordan",
"lastName": "Reed",
"email": "jordan.reed@example.test"
},
"status": "approved",
"extras": [],
"couponId": null,
"price": 330,
"persons": 1
}
],
"periods": [
{
"id": 80,
"eventId": 80,
"periodStart": "2026-03-25 17:00:00",
"periodEnd": "2026-03-27 23:40:00"
}
],
"created": "2026-03-24 15:20:44",
"type": "event"
}
],
"packageList": [
{
"id": 1,
"name": "milicas package",
"price": 200,
"deposit": 20,
"depositPayment": "percentage",
"status": "visible",
"type": "package"
}
],
"expirationDate": "2026-04-10"
}
}
}
How do I update a coupon with the Amelia API?
Use this endpoint to update an existing coupon by sending only the properties you want to change.
- Method: POST
- Path:
/coupons/{{coupon_id}}
Base path
{{your_site_URL}}/wp-admin/admin-ajax.php?action=wpamelia_api&call=/api/v1
Authorization
- All Amelia endpoints use API key authorization via a request header named Amelia.
Optional properties
- code (
string); coupon code - limit (
integer); usage limit - discount (
integer); percentage discount - deduction (
float); fixed amount deduction - customerLimit (
integer); limit per customer - notificationInterval (
integer); number of approved bookings after which a coupon is sent in a notification - notificationRecurring (
boolean); whether notificationInterval repeats, default value isfalse - status (
string); possible values:visible,hidden - services (
array); array of service IDs - events (
array); array of event IDs - packages (
array); array of package IDs - expirationDate (
string); expiration date inYYYY-MM-DDformat
Example
Request
curl --location 'https://example-site.com/wp-admin/admin-ajax.php?action=wpamelia_api&call=/api/v1/coupons/14' \
--header 'Content-Type: application/json' \
--header 'Amelia: YOUR_API_KEY' \
--data '{
"code": "SPRING20",
"discount": 0,
"deduction": 20,
"limit": 50,
"customerLimit": 1,
"notificationInterval": 0,
"notificationRecurring": false,
"status": "visible",
"events": [16],
"services": [1],
"packages": [1],
"expirationDate": "2026-05-06"
}'
Response
{
"message": "Coupon successfully updated.",
"data": {
"coupon": {
"id": 14,
"code": "SPRING20",
"discount": 0,
"deduction": 20,
"limit": 50,
"customerLimit": 1,
"used": 0,
"notificationInterval": 0,
"notificationRecurring": false,
"status": "visible",
"serviceList": [
{
"id": 1,
"name": "amelia service",
"description": "location address: %location_address%",
"color": "#1788FB",
"price": 20,
"deposit": 14,
"depositPayment": "fixed",
"depositPerPerson": true,
"pictureFullPath": null,
"pictureThumbPath": null
}
],
"eventList": [
{
"id": 16,
"name": "test5",
"price": 20,
"status": "approved",
"type": "event",
"created": "2026-03-17 16:17:27"
}
],
"packageList": [
{
"id": 1,
"name": "milicas package",
"price": 200,
"status": "visible",
"type": "package"
}
],
"expirationDate": "2026-05-06"
}
}
}
How do I retrieve coupon details with the Amelia API?
Use this endpoint to retrieve details for a single coupon.
- Method: GET
- Path:
/coupons/{{coupon_id}}
Base path
{{your_site_URL}}/wp-admin/admin-ajax.php?action=wpamelia_api&call=/api/v1
Authorization
- All Amelia endpoints use API key authorization via a request header named Amelia.
Example
Request
curl --location 'https://example-site.com/wp-admin/admin-ajax.php?action=wpamelia_api&call=/api/v1/coupons/14' \
--header 'Amelia: YOUR_API_KEY'
Response
{
"message": "Successfully retrieved coupon.",
"data": {
"coupon": {
"id": 14,
"code": "SPRING20",
"discount": 0,
"deduction": 20,
"limit": 40,
"customerLimit": 1,
"used": 0,
"notificationInterval": 0,
"notificationRecurring": false,
"status": "hidden",
"serviceList": [
{
"id": 1,
"name": "amelia service",
"price": 20,
"status": "visible"
}
],
"eventList": [
{
"id": 80,
"name": "event 123",
"price": 330,
"type": "event"
}
],
"packageList": [],
"expirationDate": "2026-05-06"
}
}
}
How do I retrieve a list of coupons with the Amelia API?
Use this endpoint to retrieve a list of coupons.
- Method: GET
- Path:
/coupons
Base path
{{your_site_URL}}/wp-admin/admin-ajax.php?action=wpamelia_api&call=/api/v1
Authorization
- All Amelia endpoints use API key authorization via a request header named Amelia.
Example
Request
curl --location 'https://example-site.com/wp-admin/admin-ajax.php?action=wpamelia_api&call=/api/v1/coupons' \
--header 'Amelia: YOUR_API_KEY'
Response
{
"message": "Successfully retrieved coupons.",
"data": {
"coupons": [
{
"id": 14,
"code": "SPRING20",
"discount": 0,
"deduction": 20,
"limit": 40,
"customerLimit": 1,
"used": 0,
"notificationInterval": 0,
"notificationRecurring": false,
"status": "hidden",
"expirationDate": "2026-05-06"
},
{
"id": 15,
"code": "WELCOME10",
"discount": 10,
"deduction": 10.5,
"limit": 100,
"customerLimit": 0,
"used": 0,
"notificationInterval": 0,
"notificationRecurring": false,
"status": "visible",
"expirationDate": null
}
],
"filteredCount": 6,
"totalCount": 6
}
}
How do I delete a coupon with the Amelia API?
Use this endpoint to delete a coupon.
- Method: POST
- Path:
/coupons/delete/{{coupon_id}}
Base path
{{your_site_URL}}/wp-admin/admin-ajax.php?action=wpamelia_api&call=/api/v1
Authorization
- All Amelia endpoints use API key authorization via a request header named Amelia.
Example
Request
curl --location --request POST 'https://example-site.com/wp-admin/admin-ajax.php?action=wpamelia_api&call=/api/v1/coupons/delete/14' \
--header 'Amelia: YOUR_API_KEY'
Response
{
"message": "Coupon successfully deleted.",
"data": {
"coupon": {
"id": 14,
"code": "SPRING20",
"discount": 0,
"deduction": 20,
"limit": 40,
"customerLimit": 1,
"used": 0,
"notificationInterval": 0,
"notificationRecurring": false,
"status": "hidden",
"expirationDate": "2026-05-06"
}
}
}