Create or replace a court

Create a bookable court on your activity listing, or replace it, by your own ID.

PUT{BASE_URL}/activity/courts/:externalId

A court is a space customers book by the slot — a futsal pitch, a badminton court. Same rules as an activity item: the whole court, a draft until published, REGISTRATION scope, the Activity module for a provider.

Body

namestringrequired
1–80 characters.
priceintegerrequired
The usual price per slot, whole taka, 0–1,000,000.
sportstringrequired
BADMINTON, FUTSAL, CRICKET, TENNIS, BASKETBALL, PICKLEBALL or OTHER.
sportNamestringoptional
OTHER only, and required for it. Up to 30 characters.
courtCountintegerrequired
How many identical courts, 1–100.
surfacestring | nulloptional
Up to 80 characters.
priceRulesobject[]optional
Up to 20 { days, from, to, price } that override price at certain times. from/to are HH:MM; to may be 24:00. Two rules may not cover the same minute on the same day.
addOnsobject[]optional
Up to 20 { name, price }, names different.
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 }.

A slot is priced by the rule covering its start time, so overlapping rules are refused (priceRules_overlap, naming the two).

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_courtsThe activity already has the most courts 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/courts/futsal-a" \
  -H "Authorization: Bearer $LOCALOY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Futsal court A",
    "price": 2000,
    "sport": "FUTSAL",
    "courtCount": 2,
    "priceRules": [
      { "days": [5, 6], "from": "18:00", "to": "24:00", "price": 3000 }
    ],
    "addOns": [{ "name": "Bibs", "price": 100 }]
  }'
Response · 400
{
  "success": false,
  "message": "18:00–22:00 and 21:00–23:00 overlap on the same day",
  "code": "priceRules_overlap",
  "details": { "field": "priceRules" }
}