A booking is a type of permit that is anonymous and not visible to existing clients in autopay.io. It is tied to the vehicle. Typical usage for a booking is providing paid parking for a hotel guests who does not wish to go through the sign up procedure.
Available resources
- GET - Get a list of permit definitions that can be used to create a booking
- GET - Get a status of a booking
- GET - Get booking's availability
- POST - Request a booking for a vehicle
- PUT - Update an existing booking
- DELETE - Delete a booking
- Error handling
For migration from V1 to V2, or from V2 to V3 (current), see Migration guide
Access requirements
- A valid authentication token is required to access the API. How to authenticate your application.
- Access to the Booking API is offered as a paid service. Please contact your Autopay representative for details.
- There is a 15-minute query rate limit per booking on the GET Get a status of a booking endpoint.
GET - Get a status of a booking
To see the restrictions applied to change a booking, please see PUT - update an existing booking.
This method allows you to retrieve a status of a booking to see if it exists and whether it has been used. There are four different statuses:
NOT_USED
- A booking that is still valid but has no parking session linked to it.IN_USE
- A booking that has a parking session linked to it and is still valid.USED
- A booking that has a parking session linked to it and is no longer valid.EXPIRED
- A booking that does not have a parking session linked to it and is no longer valid (expired due to end of validity or due to expiration time).Endpoint
GET https://api.autopay.io/booking/v3/{id}/status
Request parameters
- The HTTP headers must include a valid access token with scope:
permit_booking
. - The request path must include booking id.
Success response
HTTP Code: 200 OK
Parameter | Type | Description |
---|---|---|
status | string | Status of a booking |
Example success response
GET - Get a list of permit definitions
This method allows you to retrieve a list of permit definitions that can be used to create a booking, and their joint access limit. Permit definitions are managed by Autopay operators.
Endpoint
GET https://api.autopay.io/booking/v3/permit_definitions
Request parameters
- The HTTP headers must include a valid access token with scope:
permit_booking
.
Success response
HTTP Code: 200 OK
Parameter | Type | Description |
---|---|---|
permit_definitions | array | |
id | string | ID of the parking permit definition provided by the operator of the parking venue |
old_id | integer | ID from v2 API. Temporary field to simplify ID migration from v2 to v3 |
name | string | Name of the parking permit definition provided by the operator of the parking venue |
tenant_name | string | Name of the tenant |
access_limit | object | Maximum amount of bookings that can be active at once for each day |
mon | integer | Limit for Monday |
tue | integer | Limit for Tuesday |
wed | integer | Limit for Wednesday |
thu | integer | Limit for Thursday |
fri | integer | Limit for Friday |
sat | integer | Limit for Saturday |
sun | integer | Limit for Sunday |
Example success response
GET - Get booking's availability
This method allows you to retrieve available booking limit and it's validity period, if there is no available limit then it returns the time when there is one.
Endpoint
GET https://api.autopay.io/booking/v3/availability?valid_from={valid_from}
Request parameters
- The HTTP headers must include a valid access token with scope:
permit_booking
. - The request path must include valid_from datetime in ISO 8601 format, URL encoded.
Parameter | Type | Mandatory | Description |
---|---|---|---|
valid_from | datetime (ISO 8601) | yes | Beginning of the query period for the request. E.g. 2023-03-14T13:00:00+0200 (URL encoded: 2023-03-14T13%3A00%3A00%2B0200). |
Request example
GET https://api.autopay.io/booking/v3/availability?valid_from=2023-03-14T13%3A00%3A00%2B0200
Success response
HTTP Code: 200 OK
Parameter | Type | Description |
---|---|---|
available | boolean | Availability of booking |
limit_amount | integer | Amount of available bookings |
valid_from | datetime (ISO 8601) | Start time of availability check's validity |
valid_to | datetime (ISO 8601) | End time of availability check's validity |
Example success response
POST - Request a booking
This method allows you request a booking for a vehicle. A booking can start and end at a specific time (fixed booking) or be relative to when the vehicle enters the parking venue (entry booking). Both types can be applied either beforehand or when the parking is already in progress.
Endpoint
POST https://api.autopay.io/booking/v3
Request parameters
- The request body must be in JSON format and HTTP headers must include
Content-Type: application/json
. - The HTTP headers must include a valid access token with scope:
permit_booking
.
Parameter | Type | Mandatory | Description |
---|---|---|---|
type | string | yes | Booking type. Supported values: ENTRY or FIXED |
valid_from | datetime (ISO 8601) | no | Time from which the booking is valid. Mandatory when type is FIXED |
valid_to | datetime (ISO 8601) | no | Time until which the booking is valid. Mandatory when type is FIXED . Mandatory for type ENTRY in case duration is not set. |
duration | integer | no | Duration of booking validity in seconds. Mandatory when type is ENTRY and valid_to is not set. |
comment | string | no | Booking comment |
license_plate_number | string | no | License plate number of the end-user's vehicle. Mandatory when booking is not anonymous. |
permit_definition_id | string | yes | ID of the parking permit definition that should be used for the booking. GET a list of permit definitions |
usable_once | boolean | no | When true the booking can only be used once. When false multiple entries to the parking venue during the booking validity period are permitted. Default: false |
operator_data | JSON formatted string | no | Any operator specific information. |
anonymous_booking | boolean | no | When the vehicle is not known at the time of booking creation, anonymous booking can be created without a license plate and the customer can later link the booking to a vehicle using a kiosk. |
expiration_time | datetime (ISO 8601) | no | An expiration time can only be specified for ENTRY-type bookings. A client must take the booking into use before the expiration time. If the expiration time is not specified, a 1-year default expiration time is applied. |
Example requests
Fixed type booking
Entry type booking with duration
Entry type booking with valid_to
Success response
HTTP Code: 200 OK
Parameter | Type | Description |
---|---|---|
booking_id | string | ID of this booking |
type | string | Booking type |
valid_from | datetime (ISO 8601) | Time from which the booking is valid. Only present when type is FIXED |
valid_to | datetime (ISO 8601) | Time until which the booking is valid. Always present when type is FIXED and should be present when type is ENTRY in case duration is not set. |
duration | integer | Duration of booking validity in seconds. Present when type is ENTRY and valid_to is not set. |
license_plate_number | string | License plate number of the end-user's vehicle |
permit_definition_id | string | ID of the parking permit definition that should be used for the booking |
usable_once | boolean | Is the booking usable only once |
booking_activation_code | string | If the booking type is anonymous, activation code can be used for activating the booking using a kiosk |
expiration_time | datetime (ISO 8601) | ENTRY type booking expiration time. Present when valid_to field is not set. Not returned with FIXED bookings. |
created_at | datetime (ISO 8601) | Time when booking was created |
Example success responses
Fixed type booking
Entry type booking with duration
Entry type booking with valid_to
PUT - Update an existing booking
This method allows you to edit booking information. The following restrictions are applied when changing a booking:
- One cannot change a booking’s id, type, or anonymous flag.
- The valid from time and license plate number cannot be changed when the booking is in use (status IN_USE).
- Bookings with statuses USED and EXPIRED cannot be changed.
Endpoint
PUT https://api.autopay.io/booking/v3/{id}
Request parameters
- The request body must be in JSON format and HTTP headers must include
Content-Type: application/json
. - The HTTP headers must include a valid access token with scope:
permit_booking
. - The request path must include booking id.
Parameter | Type | Mandatory | Description |
---|---|---|---|
type | string | yes | Booking type. Supported values: ENTRY or FIXED |
valid_from | datetime (ISO 8601) | no | Time from which the booking is valid. Mandatory when type is FIXED |
valid_to | datetime (ISO 8601) | no | Time until which the booking is valid. Mandatory when type is FIXED . Mandatory for type ENTRY in case duration is not set. |
duration | integer | no | Duration of booking validity in seconds. Mandatory when type is ENTRY and valid_to is not set. |
comment | string | no | Booking comment |
license_plate_number | string | no | License plate number of the end-user's vehicle. Mandatory when booking is not anonymous. |
permit_definition_id | string | yes | ID of the parking permit definition that should be used for the booking. GET a list of permit definitions |
usable_once | boolean | no | When true the booking can only be used once. When false multiple entries to the parking venue during the booking validity period are permitted. Default: false |
operator_data | JSON formatted string | no | Any operator specific information. |
expiration_time | datetime (ISO 8601) | no | An expiration time can only be specified for ENTRY-type bookings. A client must take the booking into use before the expiration time. If the expiration time is not specified, a 1-year default expiration time is applied. |
Example requests
Fixed type booking
Entry type booking
Success response
HTTP Code: 200 OK
Parameter | Type | Description |
---|---|---|
booking_id | string | ID of this booking |
type | string | Booking type |
valid_from | datetime (ISO 8601) | Time from which the booking is valid. Only present when type is FIXED |
valid_to | datetime (ISO 8601) | Time until which the booking is valid. Always present when type is FIXED and should be present when type is ENTRY in case duration is not set. |
duration | integer | Duration of booking validity in seconds. Present when type is ENTRY and valid_to is not set. |
license_plate_number | string | License plate number of the end-user's vehicle |
permit_definition_id | string | ID of the parking permit definition that should be used for the booking |
usable_once | boolean | Is the booking usable only once |
booking_activation_code | string | If the booking type is anonymous, activation code can be used for activating the booking using a kiosk |
expiration_time | datetime (ISO 8601) | ENTRY type booking expiration time. Present when valid_to field is not set. Not returned with FIXED bookings. |
created_at | datetime (ISO 8601) | Time when booking was created |
Example success responses
DELETE - Delete a booking
This method allows you to delete end-users booking. Only unused bookings can be deleted.
Endpoint
DELETE https://api.autopay.io/booking/v3/{id}
Request parameters
- The HTTP headers must include a valid access token with scope:
permit_booking
. - The request path must include booking id.
Request example
DELETE https://api.autopay.io/booking/v3/123456
Success response
HTTP Code: 200 OK
Error messages
Parameter | Type | Description |
---|---|---|
error_id | string | Specific code of error. See below for possible values |
message | string | Description of error |
description | string | Optional value. Additional description of error |
Example error response
Possible error IDs
Error id | Explanation |
---|---|
forbidden | Unauthorized |
internal_server_error | Internal server error |
message_not_readable | A problem with the request body |
method_not_supported | Used REST method not supported |
argument_type_mismatch | A request argument is of incorrect type |
server_communication_error | Error communication with server |
invalid_type_error | Type must be one of the following: ENTRY, FIXED |
invalid_fixed_type_error | With type FIXED valid_from and valid_to must not be null and duration must be null |
invalid_entry_type_error | With type ENTRY valid_from must be null and valid_to or duration must not be null |
invalid_expiration_time_error | With type FIXED expiration time must be null |
missing_tenant_id_token_error | Missing tenant ID in token |
missing_landlord_id_token_error | Missing landlord ID in token |
missing_operator_token_error | Missing operator in token |
invalid_permit_definition_error | Invalid permit definition id {permitDefinitionId} |
delete_booking_error | Error deleting booking: {bookingId} |
delete_booking_error_booking_used | Booking is already used, cannot delete |
availability_limit_error | Concurrent booking limit exceeded for that time period |
query_limit_error | One status query is allowed per 900 seconds per client per booking |
invalid_tenant_error | Invalid tenant {tenantId} for requested bookings |
invalid_booking_error | Invalid Booking: {message}. {message} contains information about why booking validation failed |
invalid_booking_update_error | Invalid Booking update: {message}. {message} contains information about why booking validation failed |
booking_not_found_error | Did not find booking by id: {bookingId} |
get_tenant_permit_definitions_error | Error getting permit definitions for tenant |
Migration guide
Migration from V1 to V2 and version differences
- GET v2/permit_definitions
- renamed from v1/products
- POST /v2
- renamed from /v1/permit
- renamed response parameter productId to permitDefinitionId
- added optional anonymous_booking parameter to request and booking_activation_code to response if that parameter is true
- PUT /v2/{permitId}
- renamed from /v1/permit/{permitId]
- renamed response parameter productId to permitDefinitionId
- Error handling
- error_id (string) is returned instead of error_code (integer)
Migration from V2 to V3 (current version) and version differences
- Permit definitions id format changed to UUID string
- Fetch new permit definition ids GET a list of permit definitions
- All methods
- All request/response parameters are now using snake case
- Response parameters valid_from and valid_to are now formatted as follows: "2023-03-17T00:00:00+0200" -> +0000
- GET /v3/products/availability?valid_from={URL encoded date in ISO 8601}
- valid_from is now request parameter instead of path variable, and it should be URL encoded
- POST /v3
- Renamed request and response parameter licencePlate to license_plate_number
- Unified operator specific data (e.g., payment, client, flight_information) under request parameter operator_data
- Request and response parameters permit_definition_id are now UUID string
- Response parameter created_at is in the description
- PUT /v3/{id}
- Renamed request and response parameter licencePlate to license_plate_number
- Unified operator specific data (e.g., payment, client, flight_information) under request parameter operator_data
- Request and response parameters permit_definition_id are now string
- Response parameter created_at is in the description