Booking Form API
Manage events, items and bookings in the Booking Dashboard
Create and edit events and items with a limited inventory, choose what the booking fields of your forms offer, and view, change or cancel bookings: no API requests needed. Each section below shows how to do it in the dashboard first.
Open the Booking DashboardBooking forms1 let you offer a fixed number of slots for booking through an online form. They cover two use cases:
- Limit the number of registrations for an event, e.g. sell a limited number of tickets or seats for a class, a conference or a show on a registration form.
- Offer a limited inventory of products or other resources for booking and purchase, e.g. sell t-shirts of different sizes, rent out equipment, or take orders for a limited batch of goods.
The booking form is automatically disabled once the event is fully booked (or items for sale are sold out), or the booking/selling period has ended. Try this booking form demo, make a booking form in a few minutes, learn how bookings work, and contact us if you have any questions.
Until the Booking Dashboard was introduced, events and bookings could only be managed with the Booking API. The API is documented below for advanced cases: it only accepts requests from the API Console while you're signed in to your FormSmarts account, not from your own code.
Bookable Resources: Events & Inventories
A bookable resource is anything with a name, a date and a limited number of bookable slots. It can be:
- an event, whose slots are the tickets or seats available for booking. The date is the date and time of the event, and it is shown to form users.
- a product or other resource with a limited inventory, whose slots are the items available. Set is_event to no: the date then works as the date the resource stops being available, and it isn't shown to form users.
The Booking Dashboard lists both under Events & Items. For historical reasons, a bookable resource is also called an event throughout the API (e.g. event_id). The two endpoint names /api/v1/events and /api/v1/bookable_resources are interchangeable: use whichever suits what you are selling.
Who Can Manage Bookable Resources
The same permissions apply in the Booking Dashboard and the API Console:
- The account administrator can create, list, update and delete bookable resources.
- Users who have been granted the Form Builder permission can create, list and update bookable resources: reading requires the read permission, creating and updating require write. Only the account administrator can delete a bookable resource, just as only the administrator can delete a form.
- To associate bookable resources with a form, a user needs Form Builder permission on that form (read to review the integration, write to change or remove it).
How to Create an Event or Item
In the Booking Dashboard: in Events & Items, click New Event or Item. Choose Event or Item with a limited inventory, and enter its name, the number available, the date and time of the event (or the date the item is available until) and the timezone. Optionally, set when bookings open and close.
With the API: submit a POST request to the API endpoint below, providing a value for each of the required parameters.
| API Endpoint | ||
|---|---|---|
https://formsmarts.com/api/v1/eventshttps://formsmarts.com/api/v1/bookable_resources | ||
| HTTP Method | ||
POST | ||
| Parameter (in request body) | Description | Notes |
| label | Name or label of the event or bookable resource, up to 100 characters. | Required |
| slots | Total number of slots available for booking, e.g. tickets or seats for an event, items in stock for a product. | Required |
| date | Date and time of the event (or end of availability of other bookable resources) in ISO 8601 format, e.g. 2014-12-30T15:00:00. Must be in the future. | Required |
| timezone | Timezone of the event as listed here, e.g. America/Los_Angeles | Required |
| booking_starts | Date and time on which bookings start, in the timezone specified under timezone. Must be before date and booking_ends. | Optional |
| booking_ends | Date and time on which bookings end, in the timezone specified under timezone. Must not be after date. | Optional |
| is_event | Whether this bookable resource is an event ('yes' by default). Set to 'no' for a product or other resource with an inventory. | Optional |
Listing Events and Items
In the Booking Dashboard: Events & Items lists your events and items with their date, status and the number of slots booked. Show upcoming, past or all events, and filter them by status.
With the API: submit a GET request. All parameters are optional.
| API Endpoint | ||
|---|---|---|
https://formsmarts.com/api/v1/eventshttps://formsmarts.com/api/v1/bookable_resources | ||
| HTTP Method | ||
GET | ||
| Parameter (in query string) | Description | Notes |
| fields | A comma-separated list of attributes to return in the API response. Event attributes are: event_id, slots, usedslots, label, status, date, timezone, booking_starts, booking_ends, is_event | Optional |
| status | Only list events with this status: available (open for booking), not_started (bookings haven't opened yet), fully_booked, ended (bookings have closed) or suspended. | Optional |
| period | upcoming to only list events whose date hasn't passed, soonest first, or past to only list past events, most recent first. All events are listed by default, latest date first. | Optional |
| limit | Maximum number of results to return in the API response. | Optional |
| offset | If provided, results are returned in the API response starting at the element specified in offset. | Optional |
To get the details of a particular event, append the event's ID to the API endpoint URL and submit a GET request:
| API Endpoint | ||
|---|---|---|
https://formsmarts.com/api/v1/events/Event_IDhttps://formsmarts.com/api/v1/bookable_resources/Event_ID | ||
| HTTP Method | ||
GET |
Updating an Event or Item
In the Booking Dashboard: to add tickets, restock a product or move an event to another date, choose Edit in the actions menu of the event or item in Events & Items.
With the API: append the event's ID to the API endpoint and submit a PUT request with the parameters to change. Parameters you don't send keep their current value, but at least one must be provided.
| API Endpoint | ||
|---|---|---|
https://formsmarts.com/api/v1/events/Event_IDhttps://formsmarts.com/api/v1/bookable_resources/Event_ID | ||
| HTTP Method | ||
PUT | ||
| Parameter (in request body) | Description | Notes |
| label | New name or label, up to 100 characters. | Optional |
| slots | New total number of slots. Cannot be less than the number of slots already booked (usedslots). | Optional |
| date | New date and time, in ISO 8601 format. Must be in the future and not before booking_ends. | Optional |
| timezone | New timezone. Since dates are interpreted in the event's timezone, date and any of booking_starts and booking_ends that are set must be provided again in the same request. | Optional |
| booking_starts | New date and time on which bookings start. Send an empty value to remove it: bookings then open immediately. | Optional |
| booking_ends | New date and time on which bookings end. Send an empty value to remove it: bookings then remain open until date. | Optional |
| is_event | 'yes' for an event, 'no' for a product or other resource with an inventory. | Optional |
The API returns all the attributes of the updated event. Once an event has passed, only its label can be changed. Forms the event is associated with show the new label and date immediately.
Error codes specific to this request:
event.has_passed: the event has passed, only label may be changed.event.slots_below_booked: slots is less than the number of slots already booked.event.date_assertion_failed: the dates are inconsistent, e.g. date is in the past or booking_ends is after date.missing_param: no parameter was provided, or timezone was changed without providing the dates again.
Fetching Events and Items on a Booking Form
Booking forms use this request to show the events and items open for booking: you don't need to send it yourself. Basic information about active events is publicly available so it may be integrated to a booking form.
| API Endpoint | ||
|---|---|---|
https://formsmarts.com/api/v1/events/publichttps://formsmarts.com/api/v1/bookable_resources/public | ||
| HTTP Method | ||
GET | ||
| Parameter (in query string) | Description | Notes |
| session_id | The session ID of the form the booking is associated with. | Required |
| field_id | The ID of a booking field: only list the events and items it offers that are open for booking, in the order set for the field, with the number of slots a form user may book at once (max_slots). | Optional |
Deleting an Event or Item
In the Booking Dashboard: choose Delete in the actions menu of the event or item in Events & Items. The action is only offered to the account administrator, for events and items without bookings.
With the API: append the event's ID to the API endpoint and submit a DELETE request:
| API Endpoint | ||
|---|---|---|
https://formsmarts.com/api/v1/events/Event_IDhttps://formsmarts.com/api/v1/bookable_resources/Event_ID | ||
| HTTP Method | ||
DELETE |
An event may only be deleted by the account administrator, and only if it doesn't have bookings. Cancel its bookings first if needed.
How to Make a Booking Form
To make a booking form (step-by-step guide):
- Create an event or item in the Booking Dashboard.
- In Booking Forms, click Add Booking to a Form and choose one of your forms.
- Name the booking field and choose what it offers, as explained next. The field is added at the end of the form, like on this demo: you only need the Form Builder to move it.
Choosing What a Booking Field Offers
Each booking field of a form can offer all events and items open for booking, or a selection: for instance t-shirts of different sizes in one field, and workshops at different dates or locations in another. You can also limit how many of each event or item a form user may book at once.
In the Booking Dashboard: Booking Forms lists your forms with booking fields. Choose Edit booking options for a form, or Add Booking to a Form for another one, then for each booking field:
- Offer all events and items open for booking, or select some of them, with an optional maximum per booking for each
- Set the Maximum per booking, the number of slots a form user may book at once (1 to 10)
- Choose an Event name field, a text field of the form that shows the name of the event or item booked, for instance in your form reports
Add Booking Field adds another booking field at the end of the form: move it in the Form Builder if needed. Check Always show the booking window to let form users see what they book, even when the form only offers one event or item.
With the API: submit a PUT request with a JSON body (Content-Type: application/json) to the API endpoint below, replacing Form_ID with the ID of the form.
| API Endpoint | ||
|---|---|---|
https://formsmarts.com/api/v1/forms/Form_ID/booking | ||
| HTTP Method | ||
PUT | ||
| JSON Attribute | Description | Notes |
| fields | The form's booking fields, each an object with:
| Required |
| events | The events or items offered by booking fields that don't have their own list, in the same format. Empty for all events and items open for booking. | Optional |
| max_slots | How many slots a form user may book at once, for fields that don't set their own. 1 to 10, defaults to 1. | Optional |
| interactive | true to always show the booking window. Otherwise, a form with a single booking field offering a single event or item, one at a time, books it without asking. Defaults to false. | Optional |
Example: a t-shirt field offering three sizes (up to 5 of size M, 2 of the others), and a workshop field offering all events open for booking, one at a time.
{
"fields": [
{"id": 644674, "label": 644673, "max_slots": 2,
"events": [{"event_id": "a1"}, {"event_id": "a2", "max_slots": 5}, {"event_id": "a3"}]},
{"id": 644676, "max_slots": 1, "events": []}
],
"interactive": false
} FormSmarts checks bookings made through the form against these settings. The form-encoded parameters of previous versions (booking_fields, event_label_fields, event_ids, max_slots, interactive) are still supported; settings of the booking fields that remain are kept.
Reviewing a Form's Booking Options
In the Booking Dashboard: Booking Forms lists your forms with their booking fields, what each offers and the maximum per booking.
With the API: to list the current booking options of a form, submit a GET request. The response has the attributes above, with the current name, date and type of the events and items listed.
| API Endpoint | ||
|---|---|---|
https://formsmarts.com/api/v1/forms/Form_ID/booking | ||
| HTTP Method | ||
GET |
To list all your forms with booking fields, submit a GET request to:
| API Endpoint | ||
|---|---|---|
https://formsmarts.com/api/v1/forms/booking | ||
| HTTP Method | ||
GET |
Removing a Form's Booking Options
To stop taking bookings on a form, delete its booking fields in the Form Builder. With the API, a DELETE request resets the form's booking options: its booking fields then offer all events and items open for booking, one at a time.
| API Endpoint | ||
|---|---|---|
https://formsmarts.com/api/v1/forms/Form_ID/booking | ||
| HTTP Method | ||
DELETE |
Managing Bookings
Bookings in the Booking Dashboard lists the bookings of all upcoming events and items, or of one of them, with their slot, status, date and form entry. Filter them by status: confirmed, pending (pre-booked until the form is submitted) or expired.
Booking an Event
Form users book events and items on your booking forms. With the API, send a POST request to book a slot for an event: the slot is pre-booked, and a booking form must be submitted within 30 minutes to confirm the booking.
| API Endpoint | ||
|---|---|---|
https://formsmarts.com/api/v1/bookings | ||
| HTTP Method | ||
POST | ||
| Parameter (in request body) | Description | Notes |
| event_id | The ID of the event. | Required |
| session_id | The session ID of the form the booking is associated with. | Required unless the request is authenticated. |
| allow_multiple | Allow multiple bookings to be associated with a form entry. 'yes' or 'no' ('no' by default). | Optional |
| field_id | The ID of the booking field the booking is made with. If the form has booking settings, the event must be offered by the field, and the form user may not book more of it than allowed (error code booking.max_slots_reached). | Optional |
| auto_confirm | Confirm the booking immediately. Requires an authenticated request. 'yes' or 'no' ('no' by default). | Optional |
| fs_ref_num | The FormSmarts Reference Number of the form submission to associate with the booking. | Required if auto_confirm is 'yes'. |
Note: List events/bookable resources as described above to find out the ID of an event or other bookable resource.
Changing a Booking
In the Booking Dashboard: choose Change booking in the actions menu of a booking in Bookings to move it to another event or item, for instance when an attendee switches to another date, or a buyer wants a different color or size of an item they bought. The form entry keeps its booking, and the slot it had becomes available again.
Canceling a Booking
In the Booking Dashboard: choose Cancel booking in the actions menu of the booking in Bookings. The slot becomes available again.
With the API: append the booking's ID to the URL and send a DELETE request:
| API Endpoint | ||
|---|---|---|
https://formsmarts.com/api/v1/bookings/Booking_ID | ||
| HTTP Method | ||
DELETE | ||
| Parameter (in query string) | Description | Notes |
| session_id | A booking can be canceled by the FormSmarts account admin or the form user that made the booking. To cancel a booking as a form user, pass the session ID of the form associated with the booking in the session_id parameter. | Required unless the request is authenticated |
Listing the Details of a Booking
In the Booking Dashboard: Bookings shows the slot, status and date of each booking, with a link to its form entry.
With the API: append the booking's ID to the URL and submit a GET request:
| API Endpoint | ||
|---|---|---|
https://formsmarts.com/api/v1/bookings/Booking_ID | ||
| HTTP Method | ||
GET | ||
| Parameter (in query string) | Description | Notes |
| fields | A comma-separated list of attributes to return in the API response. Options are: fs_ref_num, event_id, slot, status, booking_id, booking_date | Optional |
Listing All Bookings for an Event
In the Booking Dashboard: choose Bookings in the actions menu of the event or item in Events & Items, or select it in Bookings.
With the API: insert the event's ID in the URL and submit a GET request:
| API Endpoint | ||
|---|---|---|
https://formsmarts.com/api/v1/events/Event_ID/bookingshttps://formsmarts.com/api/v1/bookable_resources/Event_ID/bookings | ||
| HTTP Method | ||
GET | ||
| Parameter (in query string) | Description | Notes |
| fields | A comma-separated list of attributes to return in the API response. Options are: fs_ref_num, event_id, slot, status, booking_id, booking_date, event_date | Optional |
| status | Only list bookings with this status: confirmed, prebooked (pending until the booking form is submitted) or expired. | Optional |
| limit | Maximum number of results to return in the API response. | Optional |
| offset | If provided, results are returned in the API response starting at the element specified in offset. | Optional |
- Booking forms, the Booking Dashboard and the Booking API are included with the Business Max plan and higher. See pricing.