Booking API

The Booking API allows you to integrate with Autopay to create anonymous parking permits (bookings) for a vehicle.

By accessing or using the API, the integrator agrees to be bound by the terms and conditions of Booking API.

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


For migration from V1 to V2, or from V2 to V3 (current), see Migration guide

Access requirements


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

{
    "status": "USED"
}

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

{
    "permit_definitions": [
        {
            "id": "802a2829-0c29-4a95-9960-1e73ca03dcd5",
            "old_id": 123645,
            "name": "Hotel guest parking in zone 215",
            "tenant_name": "Example tenant",
        },
        {
            "id": "c4959ab3-81c6-420d-8c81-8dc18db0db14",
            "old_id": 775820,
            "name": "Airport - Online booking",
            "tenant_name": "Example tenant",
        }
    ],
    "access_limit": {
        "mon": 1,
        "tue": 1,
        "wed": 1,
        "thu": 2,
        "fri": 1,
        "sat": 1,
        "sun": 1
    }
}

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

{
    "available": false,
    "limit_amount": 10,
    "valid_from": "2023-03-17T00:00:00+0000",
    "valid_to": "2023-03-22T00:00:00+0000"
}

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
{
    "type": "FIXED",
    "valid_from": "2023-03-14T00:00:00+0200",
    "valid_to": "2023-03-21T00:00:00+0200",
    "license_plate_number": "123ABC",
    "permit_definition_id": "802a2829-0c29-4a95-9960-1e73ca03dcd5",
    "operator_data": {
        "payment": {
            "amount": 370,
            "currency": "NOK"
        },
        "customer": {
            "email": "test@test.com",
            "mobile": "+47123456"
        },
        "travel_information": {
            "flight_id": "AB123"
        }
    }
}
Entry type booking with duration
{
    "type": "ENTRY",
    "duration": 18000,
    "expiration_time": "2023-03-21T00:00:00+0200",
    "comment": "comment",
    "usable_once": true,
    "license_plate_number": "456DEF",
    "permit_definition_id": "802a2829-0c29-4a95-9960-1e73ca03dcd5"
}
Entry type booking with valid_to
{
    "type": "ENTRY",
    "valid_to": "2023-03-21T00:00:00+0200",
    "comment": "comment",
    "usable_once": true,
    "license_plate_number": "789GHI",
    "permit_definition_id": "802a2829-0c29-4a95-9960-1e73ca03dcd5"
}

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
{
    "booking_id": "123456",
    "type": "FIXED",
    "license_plate_number": "123ABC",
    "valid_from": "2023-03-13T22:00:00+0000",
    "valid_to": "2023-03-20T22:00:00+0000",
    "permit_definition_id": "802a2829-0c29-4a95-9960-1e73ca03dcd5",
    "created_at": "2023-03-14T11:24:38+0000"
}
Entry type booking with duration
{
    "booking_id": "123457",
    "type": "ENTRY",
    "license_plate_number": "456DEF",
    "expiration_time": "2023-03-20T22:00:00+0000",
    "duration": 18000,
    "permit_definition_id": "802a2829-0c29-4a95-9960-1e73ca03dcd5",
    "created_at": "2023-03-14T11:24:38+0000",
    "usable_once": true
}
Entry type booking with valid_to
{
    "booking_id": "123458",
    "type": "ENTRY",
    "license_plate_number": "789GHI",
    "permit_definition_id": "802a2829-0c29-4a95-9960-1e73ca03dcd5",
    "created_at": "2023-03-14T11:24:38+0000",
    "usable_once": true
}

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
{
    "type": "FIXED",
    "valid_from": "2023-03-14T00:00:00+0200",
    "valid_to": "2023-03-30T00:00:00+0200",
    "license_plate_number": "123ABC",
    "permit_definition_id": "802a2829-0c29-4a95-9960-1e73ca03dcd5",
    "operator_data": {
        "payment": {
            "amount": 370,
            "currency": "NOK"
        },
        "customer": {
            "email": "test@test.com",
            "mobile": "+47123456"
        },
        "travel_information": {
            "flight_id": "AB123"
        }
    }
}
Entry type booking
{
    "type": "ENTRY",
    "duration": 21000,
    "license_plate_number": "456DEF",
    "usable_once": true,
    "permit_definition_id": "802a2829-0c29-4a95-9960-1e73ca03dcd5"
}

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

{
    "booking_id": "123456",
    "type": "FIXED",
    "license_plate_number": "123ABC",
    "valid_from": "2023-03-13T22:00:00+0000",
    "valid_to": "2023-03-29T22:00:00+0000",
    "permit_definition_id": "802a2829-0c29-4a95-9960-1e73ca03dcd5",
    "created_at": "2023-03-14T11:26:37+0000"
}
{
    "booking_id": "123457",
    "type": "ENTRY",
    "license_plate_number": "456DEF",
    "expiration_time": "2024-03-13T11:26:37+0000",
    "duration": 21000,
    "permit_definition_id": "802a2829-0c29-4a95-9960-1e73ca03dcd5",
    "created_at": "2023-03-14T11:26:37+0000",
    "usable_once": true
}

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

{
    "error_id": "authentication_error",
    "message": "No access token present in header!"
}

Possible error IDs

Error id Explanation
forbidden Unauthorized
internal_server_error Internal server error
missing_property A required property in request is missing
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 Invalid value for 'type'
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
operator_not_found_error Operator not found
invalid_permit_definition_error Permit definition not found by given id
delete_booking_error_booking_used Booking is already used and can't be deleted

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
  • 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