Permit E-commerce API

The Permit E-commerce API allows you to manage tenants and their permit allocations. Access to this API is given for a landlord.

By accessing or using the API, the integrator agrees to be bound by the terms and conditions of Permit E-commerce API.

Access requirements:

Permit Management

The Permit E-commerce API can be used by landlords to issue permit allocations to tenants. The API supports creating, updating and deleting permit allocations as well as creating and querying tenants.

Available operations:

GET - Get the available permit definitions

This method allows you to get all available permit definitions for a landlord that can be used to issue permit allocations.

Endpoint

GET https://api.autopay.io/permit/v2/landlord/{landlordId}/permitDefinitions

Request parameters:

  • The HTTP headers must include a valid access token.
  • The access token must include operator_id and landlord_id.
  • landlordId is the ID of the landlord for which this query should be run.

Success response:

HTTP Code: 200 OK

Parameter Type Description
landlord_id string The ID of the landlord that the following permit definitions belong to.
permit_definitions array The actual list of permit definitions that are available under the given landlord.
permit_definition_id string Permit definition ID
permit_definition_name string Permit definition name
facilities array The list of facilities in which this kind of permit is valid.
facility_code string The ID (code) of the facility
facility_name string The display name of the facility
zones array The list of zones within the facility where this kind of permit is valid.
zone_code string The ID (code) of the zone
zone_name string The display name of the zone

Example success response:

{
    "landlord_id": "1a6f4e3b-2db6-46ea-a095-a8c76c995596",
    "permit_definitions": [
        {
            "permit_definition_id": "37ae77b3-a66d-4bde-ba95-ae66f18f90a9",
            "permit_definition_name": "Free parking from 5 to 9",
            "facilities": [
                {
                    "facility_code": "34124",
                    "facility_name": "Supremax city center",
                    "zones": [
                        {
                            "zone_code": "15124",
                            "zone_name": "Upper level",
                        }
                    ]
                }
            ]
        }
    ]
}

PUT - Create a new tenant

Creates a new tenant and returns the new tenant's ID. Even though the tenant ID is returned, it might take a couple of seconds for the tenant to be created in all subsystems. Using the newly created tenant ID in a subsequent request might lead to an error in case the second request is sent in immediately after the first one. In such case the second request should be retried a few seconds later.

Endpoint

PUT https://api.autopay.io/permit/v2/landlord/{landlordId}/tenant/new

Request parameters:

  • The HTTP headers must include a valid access token.
  • The access token must include operator_id and landlord_id.
  • landlordId is the ID of the landlord under which the new tenant should be created.
Parameter Type Description
name string The name of the new tenant. This will be set both as tenant name & the display name for the tenant which is visible only for landlords.
manager_email string The email address of the new tenant's manager.
type enum Sets the type of the new tenant. The possible values are FULL and BASIC. Use FULL if the tenant is a company, or if they will receive more than one permit per allocation. Such tenants will have access to other functionality too in autopay.io - like booking and Tap & Park. BASIC tenant should be used in case the tenant is an individual, and should be receiving exactly one permit per allocation.

Example request:

{
    "name": "My new tenant",
    "manager_email": "example@autopay.io",
    "type": "FULL"
}

Success response:

HTTP Code: 200 OK

Parameter Type Description
tenant_id string The ID of the new tenant.

GET - Get a tenant's existing permit allocations

This method returns all existing permit allocations that belong to the given tenant. The list includes all permit allocations, regardless of whether they were created via this API, or in autopay.io.

Endpoint

GET https://api.autopay.io/permit/v2/landlord/{landlordId}/tenant/{tenantId}

Request parameters:

  • The HTTP headers must include a valid access token.
  • The access token must include operator_id and landlord_id.
  • landlordId is the ID of the landlord which the tenant in question belongs to.
  • tenantId is the ID of the tenant for which this query should be run.

Success response:

HTTP Code: 200 OK

Parameter Type Description
name string The display name of the tenant, as set by the tenant manager(s)
tenant_id string The ID of the tenant to which the following permit allocations belong.
permit_allocations array The list of permit allocations that the tenant has access to.
updated_via_api boolean This field is true if the given allocation was created or has been updated via this API. Allocations that have been created directly in autopay.io (and have not been updated by this API) will have this flag set to false.
permit_allocation_id string The ID of the permit allocation.
permit_definition_id string The ID of the permit definition that this allocation was created with.
parking_spaces_count number The number of parking spaces that can be used simultaneously by the users of this permit allocation.
permit_count number The number of permits that the tenant is allowed to issue to end-users.
valid_from ISO date The day from which this permit allocation is valid.
valid_to ISO date The day until which this permit allocation is valid.
time_zone_id string The ID of the time zone where the validity dates should be interpreted

Example success response:

{
    "name": "My tenant",
    "tenant_id": "b8148a3c-591d-4fc5-9d29-d2917393ed1c",
    "permit_allocations": [
        {
            "updated_via_api": true,
            "permit_allocation_id": "f8ab6b8b-3b20-419a-9381-aec7d76ec2a6",
            "permit_definition_id": "37ae77b3-a66d-4bde-ba95-ae66f18f90a9",
            "parking_spaces_count": 10,
            "permit_count": 20,
            "valid_from": "2018-06-19",
            "valid_to": "2028-01-13",
            "time_zone_id": "Europe/Oslo"
        }
    ]
}

Error responses

Code Explanation
409 Conflict The tenant that the query was run for is not fully created yet. This condition should not last more than a few seconds. Retry the request later.

PUT - Create a new permit allocation

Creates a new permit allocation on an existing tenant.

Endpoint

PUT https://api.autopay.io/permit/v2/landlord/{landlordId}/permitAllocations/new

Request parameters:

  • The HTTP headers must include a valid access token.
  • The access token must include operator_id and landlord_id.
  • landlordId is the ID of the landlord under which the new allocation should be created.
Parameter Type Description
tenant_id string The ID of the tenant for which the new allocation should be created.
permit_definition_id string The ID of the permit definition that this allocation should be created with.
parking_spaces_count number The number of parking spaces that can be used simultaneously by the users of this permit allocation. For basic tenants, this should be set to 1.
permit_count number The number of permits that the tenant is allowed to issue to end-users. For basic tenants, this should be set to 1.
valid_from ISO date The day from which this permit allocation is valid.
valid_to ISO date The day until which this permit allocation is valid. The latest date accepted is 2099-01-01, which means no end date.

Example request:

{
    "tenant_id": "b8148a3c-591d-4fc5-9d29-d2917393ed1c",
    "permit_allocation": {
        "permit_definition_id": "37ae77b3-a66d-4bde-ba95-ae66f18f90a9",
        "parking_spaces_count": 10,
        "permit_count": 20,
        "valid_from": "2018-06-19",
        "valid_to": "2028-01-13"
    }
}

Success response:

HTTP Code: 200 OK

Parameter Type Description
tenant_id string The ID of the tenant to which the following, new permit allocation belongs.
permit_allocation_id string The ID of the permit allocation.
parking_spaces_count number The number of parking spaces that can be used simultaneously by the users of this permit allocation.
permit_count number The number of permits that the tenant is allowed to issue to end-users.
valid_from ISO date The day from which this permit allocation is valid.
valid_to ISO date The day until which this permit allocation is valid.
time_zone_id string The ID of the time zone where the validity dates should be interpreted

Example success response:

{
    "tenant_id": "b8148a3c-591d-4fc5-9d29-d2917393ed1c",
    "permit_allocation": {
        "permit_allocation_id": "f8ab6b8b-3b20-419a-9381-aec7d76ec2a6",
        "parking_spaces_count": 10,
        "permit_count": 20,
        "valid_from": "2018-06-19",
        "valid_to": "2028-01-13",
        "time_zone_id": "Europe/Oslo"
    }
}

Error responses

Code Explanation
409 Conflict The tenant that should be receiving the permit allocation is not fully created yet. This condition should not last more than a few seconds. Retry the request later.

POST - Update permit allocation

Updates an existing permit allocation. If the allocation was originally created via autopay.io (and hence has the updated_via_api flag set to false), it will cause this flag to be set to true permanently. It might happen that the update cannot be applied as requested, e.g due to more permits being issued than the updated number of available permits. In this case the new number is going to be as close as possible to what was requested. The result of the update is returned in the response.

Endpoint

POST https://api.autopay.io/permit/v2/landlord/{landlordId}/tenant/{tenantId}/permitAllocations/{permitAllocationId}

Request parameters:

  • The HTTP headers must include a valid access token.
  • The access token must include operator_id and landlord_id.
  • landlordId is the ID of the landlord under which the allocation should be updated.
  • tenantId is the ID of the tenant under which the allocation should be updated.
  • permitAllocationId is the ID of allocation to be updated.
Parameter Type Description
parking_spaces_count number The number of parking spaces that can be used simultaneously by the users of this permit allocation. For basic tenants, this should be set to 1.
permit_count number The number of permits that the tenant is allowed to issue to end-users. For basic tenants, this should be set to 1.
valid_from ISO date The day from which this permit allocation is valid. It can only be changed if the permit allocation has not been activated, meaning the valid_from date has passed. Not required.
valid_to ISO date The day until which this permit allocation is valid. The latest date accepted is 2099-01-01, which means no end date.

Example request:

{
    "parking_spaces_count": 10,
    "permit_count": 20,
    "valid_from": "2018-06-19",
    "valid_to": "2028-01-13"
}

Success response:

HTTP Code: 200 OK

Parameter Type Description
tenant_id string The ID of the tenant to which the following permit allocation belongs.
permit_allocation_id string The ID of the permit allocation.
parking_spaces_count number The number of parking spaces that can be used simultaneously by the users of this permit allocation.
permit_count number The number of permits that the tenant is allowed to issue to end-users.
valid_from ISO date The day from which this permit allocation is valid.
valid_to ISO date The day until which this permit allocation is valid.
time_zone_id string The ID of the time zone where the validity dates should be interpreted

Example success response:

{
    "tenant_id": "b8148a3c-591d-4fc5-9d29-d2917393ed1c",
    "permit_allocation": {
        "permit_allocation_id": "f8ab6b8b-3b20-419a-9381-aec7d76ec2a6",
        "parking_spaces_count": 10,
        "permit_count": 20,
        "valid_from": "2018-06-19",
        "valid_to": "2028-01-13",
        "time_zone_id": "Europe/Oslo"
    }
}

DELETE - Delete permit allocation

Deletes an existing permit allocation.

Endpoint

DELETE https://api.autopay.io/permit/v2/landlord/{landlordId}/tenant/{tenantId}/permitAllocations/{permitAllocationId}

Request parameters:

  • The HTTP headers must include a valid access token.
  • The access token must include operator_id and landlord_id.
  • landlordId is the ID of the landlord under which the allocation should be deleted.
  • tenantId is the ID of the tenant under which the allocation should be deleted.
  • permitAllocationId is the ID of allocation to be deleted.

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 ID-s:

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
fetch_tenant_issued_permits_error Error fetching tenant's issued permits.
fetch_tenant_allocations_error Error fetching tenant allocations.
allocate_end_user_permit_error Error allocating end user permit.
update_end_user_permit_error Error updating end user permit.
remove_end_user_permit_error Error removing end user permit.
operator_not_found_error Operator not found.
update_permit_allocation_request_failure Request failure when updating permit allocation
update_permit_allocation_failed_to_fetch_landlord Failed to fetch landlord
update_permit_allocation_failed_to_authorize_for_landlord The landlord is not under the given operator
update_permit_allocation_api_access_not_enabled_for_operator API access is not enabled for landlord
delete_permit_allocation_request_failure Request failure when updating permit allocation
delete_permit_allocation_failed_to_fetch_landlord Failed to fetch landlord
delete_permit_allocation_failed_to_authorize_for_landlord The landlord is not under the given operator
delete_permit_allocation_api_access_not_enabled_for_operator API access is not enabled for landlord
missing_operator_token_error Missing operator in access token
missing_landlord_token_error Missing landlord in access token