How do I manage package purchases with the Amelia API
Use the package purchases endpoints to create a package purchase for a customer, add appointments that consume package services, update purchase status, check remaining package slots, and delete a purchase when needed.
You can review all endpoints and examples in the Amelia API Postman collection.
How do I create a package purchase with the Amelia API?
Use this endpoint to create a package purchase for a specific customer. This creates the purchase record and can optionally notify the customer.
- Method: POST
- Path:
/packages/customers
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
- packageId (
integer); package ID - customerId (
integer); customer ID - notify (
boolean); whether the customer should be notified about this purchase
Example
Request
curl --location 'https://example-site.com/wp-admin/admin-ajax.php?action=wpamelia_api&call=/api/v1/packages/customers' \
--header 'Content-Type: application/json' \
--header 'Amelia: YOUR_API_KEY' \
--data '{
"packageId": 14,
"customerId": 16,
"notify": true
}'
Response
{
"message": "Successfully added new package booking.",
"data": {
"packageCustomerId": 115,
"notify": true,
"paymentId": 1154,
"onlyOneEmployee": null
}
}
How do I add an appointment to a package purchase with the Amelia API?
Use this endpoint to create an appointment that uses a service from a specific package purchase. The booking payload must include packageCustomerService with the related packageCustomer ID so Amelia can link the booking to the purchase.
- Method: POST
- Path:
/appointments
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
- bookings (
array); array of booking objects - serviceId (
integer); service ID - providerId (
integer); employee ID - bookingStart (
string); appointment start inYYYY-MM-DD HH:mmformat
Other properties
- notifyParticipants (
integer); whether the customer should be notified, possible values:1,0 - internalNotes (
string); internal appointment notes - lessonSpace (
string); LessonSpace room ID - locationId (
integer); location ID
Example
Request
curl --location 'https://example-site.com/wp-admin/admin-ajax.php?action=wpamelia_api&call=/api/v1/appointments' \
--header 'Content-Type: application/json' \
--header 'Amelia: YOUR_API_KEY' \
--data '{
"serviceId": 1,
"providerId": 1,
"locationId": 2,
"bookings": [
{
"customerId": 16,
"status": "approved",
"duration": 3600,
"persons": 1,
"extras": [],
"customFields": "{\"1\":{\"label\":\"text\",\"value\":\"\",\"type\":\"text\"},\"4\":{\"label\":\"Address\",\"value\":\"\",\"type\":\"address\"}}",
"packageCustomerService": {
"packageCustomer": {
"id": 115
}
}
}
],
"bookingStart": "2026-03-18 09:30",
"notifyParticipants": 1,
"internalNotes": "Booked as part of a package purchase.",
"lessonSpace": null
}'
Response
{
"message": "Successfully added new appointment",
"data": {
"appointment": {
"id": 851,
"bookings": [
{
"id": 1147,
"customerId": 16,
"customer": null,
"status": "approved",
"extras": [],
"couponId": null,
"price": 23,
"coupon": null,
"customFields": "{\"1\":{\"label\":\"text\",\"value\":\"\",\"type\":\"text\"},\"4\":{\"label\":\"Address\",\"value\":\"\",\"type\":\"address\"}}",
"info": null,
"appointmentId": 851,
"persons": 1,
"token": "8c614c916d",
"payments": [],
"utcOffset": null,
"aggregatedPrice": true,
"isChangedStatus": true,
"isLastBooking": null
}
],
"notifyParticipants": 0,
"internalNotes": null,
"status": "approved",
"serviceId": 1,
"providerId": 1,
"locationId": 2,
"bookingStart": "2026-03-18 09:30:00",
"bookingEnd": "2026-03-18 10:30:00",
"type": "appointment",
"resources": []
},
"recurring": []
}
}
How do I update a package purchase status with the Amelia API?
Use this endpoint to update the status of a package purchase, for example to cancel a purchase.
- Method: POST
- Path:
/packages/customers/{{package_customer_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.
Required properties
- status (
string); new purchase status, possible values:approved,canceled
Example
Request
curl --location 'https://example-site.com/wp-admin/admin-ajax.php?action=wpamelia_api&call=/api/v1/packages/customers/115' \
--header 'Content-Type: application/json' \
--header 'Amelia: YOUR_API_KEY' \
--data '{
"status": "canceled"
}'
Response
{
"message": "Successfully updated package",
"data": {
"packageCustomerId": "115",
"status": "canceled"
}
}
How do I retrieve available package slots with the Amelia API?
Use this endpoint to retrieve how many slots are available for each service within a package purchase for a specific customer.
- Method: GET
- Path:
/package-purchases/slots
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 query parameters
- packageId (
int); package ID - customerId (
int); customer ID
Example
Request
curl --location 'https://example-site.com/wp-admin/admin-ajax.php?action=wpamelia_api&call=/api/v1/package-purchases/slots&packageId=3&customerId=3' \
--header 'Amelia: YOUR_API_KEY'
Response
{
"message": "Successfully retrieved available package slots",
"data": [
{
"customerId": 3,
"packages": [
{
"packageId": 3,
"purchases": [
{
"purchase": [
{
"serviceId": 1,
"available": 3,
"total": 4
},
{
"serviceId": 5,
"available": 3,
"total": 4
}
],
"purchased": "2026-04-29 16:42",
"packageCustomerId": 79
}
]
}
]
}
]
}
How do I delete a package purchase with the Amelia API?
Use this endpoint to delete a package purchase and update related appointments and bookings where needed.
- Method: POST
- Path:
/packages/customers/delete/{{package_customer_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/packages/customers/delete/115' \
--header 'Amelia: YOUR_API_KEY' \
--data ''
Response
{
"message": "Successfully deleted package purchase.",
"data": {
"packageCustomer": {
"id": 115,
"packageId": 14,
"customerId": 16,
"price": 180,
"payments": [],
"start": "2026-03-06 15:25:58",
"end": null,
"purchased": "2026-03-06 15:25:58",
"status": "canceled",
"bookingsCount": 0,
"couponId": null,
"coupon": null
}
}
}