Create or replace a class

Create a weekly class on your activity listing, or replace it, by your own ID.

PUT{BASE_URL}/activity/classes/:externalId

A class runs on set days at a set time with a fixed number of spots, and customers book a seat in one session. Same rules as an activity item: the whole class, a draft until published, REGISTRATION scope, the Activity module for a provider.

Body

namestringrequired
1–80 characters.
priceintegerrequired
Per seat, whole taka, 0–1,000,000.
daysinteger[]required
Weekdays it runs, 0 = Sunday … 6 = Saturday, each once.
startTimestringrequired
24-hour HH:MM, Dhaka time.
durationMinutesintegerrequired
5–720.
spotsintegerrequired
Seats per session, 1–1,000.
runsUntilstring | nulloptional
The last date it runs, YYYY-MM-DD. null means it keeps running.
categorystring | nulloptional
Up to 40 characters.
descriptionstring | nulloptional
Up to 500 characters.
imagestring | nulloptional
A URL from POST /media.
locationIdsstring[]optional
IDs from GET /locations.
linkobject | nulloptional
{ url, label }.

Errors name the field: days_required, days_duplicate, startTime_invalid, runsUntil_invalid (including dates that do not exist, like 2026-02-30), spots_invalid, durationMinutes_invalid.

Deleting a class keeps its past bookings; they just no longer point at it.

Status codes#

StatusCodeWhen
201—Created, as a draft.
200—Replaced, or "dryRun": true for a sandbox key.
400unknown_field, <field>_required, <field>_invalid, <field>_too_long, <field>_too_manyA field is missing or wrong. details.field names it. See Errors.
400image_not_importedimage is not a URL from POST /media.
400location_not_found, locationIds_invalidA locationIds entry is not one of your locations, or the list is not an array of at most 50 IDs.
400externalId_invalidThe externalId is not 1–128 letters, digits or . _ ~ : -.
403provider_module_not_allowedA Technology Provider without the Activity module.
409activity_not_set_upYou have no activity listing yet. Set it up in the Partner Portal.
409too_many_classesThe activity already has the most classes it can hold.
409resource_busyAnother request is creating this externalId. Retry in a moment.
409resource_managed_elsewhereA Technology Provider wrote an externalId another integration holds.
cURL
curl -X PUT "$LOCALOY_BASE_URL/activity/classes/yoga-am" \
  -H "Authorization: Bearer $LOCALOY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Morning yoga",
    "price": 500,
    "days": [1, 3, 5],
    "startTime": "07:00",
    "durationMinutes": 60,
    "spots": 12,
    "runsUntil": "2026-12-31"
  }'
Response · 201
{
  "success": true,
  "message": "Class created as a draft — publish it to show it to customers",
  "dryRun": false,
  "created": true,
  "data": {
    "externalId": "yoga-am",
    "id": "cm4c1ass00000000000001",
    "name": "Morning yoga",
    "price": 500,
    "category": null,
    "description": null,
    "image": null,
    "locationIds": [],
    "link": null,
    "days": [1, 3, 5],
    "startTime": "07:00",
    "durationMinutes": 60,
    "spots": 12,
    "runsUntil": "2026-12-31",
    "published": false,
    "updatedAt": "2026-11-10T10:00:00.000Z"
  }
}