Accounting API

Retrieve invoices generated by Autopay.

Available resources:

Access requirements:

  • A valid authentication token is required to access the API. How to authenticate your application
  • API credentials define access to the data so that one can access either only PAID invoices, only UNPAID invoices, or both. When requesting access from 2Park, the operator should specify what kind of access is needed.

GET Get invoices

This service allows you to retrieve all invoices in a period. An invoice can have multiple invoice items that are linked to parking sessions by the same vehicle or client.

Endpoint

GET https://api.autopay.io/accounting/v1/invoices

Request parameters

  • Path parameters must include a date interval.
  • Request parameters must be URL encoded.
  • Data is not propagated to the Accounting API in real-time; therefore, all the queries should be delayed as well and not made in real-time.
  • The request path must include a date interval, either for invoice date (parameters "invoice_date_from" and "invoice_date_to") or time on which the data was registered/updated in the Accounting API (parameters "from" and "to"). Accounting API features two sets of date parameters to query invoices and sales from the API to allow covering different use cases on how to acquire data from the API. Parameters "from" and "to" allow to query data based on the time the data became available or updated in the API. These parameters will enable acquiring data continuously and get all the new data that comes available. Parameters "invoice_date_from" and "invoice_date_to" will allow acquiring data for a specific timeframe (e.g., all invoices from March 2019).
    IMPORTANT: Both date intervals cannot be used at once!
  • When making multiple or recurring requests to the API it is recommended to use the exact to or invoice_date_to parameter from the previous request as from or invoice_date_from to prevent any data loss.

Parameter Type Mandatory Description
from datetime (ISO 8601) no Beginning of the query period for a request to get data based on the time the data was updated in the API, e.g. 2016-02-02T12:15:00+0200 (URL encoded: 2016-02-02T12:15:00%2B0200).
to datetime (ISO 8601) no End of the query period for a request to get data based on the time the data was updated in the API, e.g. 2017-02-02T12:15:00+0200 (URL encoded: 2017-02-02T12:15:00%2B0200).
invoice_date_from datetime (ISO 8601) no Beginning of the query period for a request to get data based on the invoice date, e.g. 2017-02-02T12:15:00+0200 (URL encoded: 2017-02-02T12:15:00%2B0200).
invoice_date_to datetime (ISO 8601) no End of the query period for a request to get data based on the invoice date, e.g. 2017-02-02T12:15:00+0200 (URL encoded: 2017-02-02T12:15:00%2B0200).
status string no Invoice status. Supported values: PAID, UNPAID
cursor string no Use the cursor string returned with response to get the next set of results.

Example request

https://api.autopay.io/accounting/v1/invoices?from=2018-01-15T12:15:00%2B0200&to=2018-01-17T12:15:00%2B0200&status=PAID&cursor=CkIKGAoL...

Success response

HTTP Code: 200 OK

Parameter Type Description
invoices array of Invoices
summary Summary
Invoice
id string ID of the invoice
status string Status of the invoice: PAID, UNPAID
operator string Operator of the Autopay location
invoice_date date Date when the invoice was generated
created_at datetime (ISO 8601) Date when the invoice was created
updated_at datetime (ISO 8601) Date when the invoice was updated
currency string Currency of the invoice.
client Client
items array of Items
payments array of Payments
Client
id string Client ID is a unique ID for the specific client. The client ID comes either from the owner lookup service provider or is generated by the Autopay system based on the client data.
email string Client contact email address
type string Type of the client: REGULAR, TENANT or LANDLORD
phone string Client telephone number
name string Name of the client
address string Client billing address
postal_code string Client postal (zip) code
company_number string Client company number
city string Client city
country string Client country
birth_date date Client birth date
operator_data OperatorData Operator data is a custom JSON field containing the operator's custom elements that need to be forwarded to the Accounting API.
reference srting Reference field from tenants billing data.
Item
id string
description string Short description of item origins based on operator-specific template
parking_session ParkingSession
vat_percent decimal VAT percent applied to item amount
net_price decimal Price of the invoice item without VAT
vat_amount decimal VAT amount included in the price
gross_price decimal Price of the invoice item with VAT
accounting_object string Unique code used in accounting systems
Payment
id string ID of the payment
paid_at datetime (ISO 8601) Time of the payment
paid_amount decimal Amount paid
sender_account string Account used for payment
transaction_id string ID of the transaction, returned by the payment provider
reference string Transaction reference, returned by the payment provider
message string Transaction message, returned by the payment provider
payment_channel string Payment channel used for the payment
payment_provider PaymentProvider
PaymentProvider
name string Name of the provider responsible for handling the payment
code string Unique code of the payment provider
ParkingSession
id string ID of the parking session
start_time datetime (ISO 8601) Start time of the parking session related to the invoice item
end_time datetime (ISO 8601) End time of the parking session related to the invoice item
zone_name string Name of the facility related to the parking session
zone_code string Code of the facility related to the parking session
vehicle_reg string Vehicle registration (number plate) of the vehicle parked
vehicle_nationality string Nationality (country code) of the vehicle parked
vehicle_region string Region (subdivision) of the vehicle parked
product_name string Product name used for parking
invoicing_fee boolean Marker of whether the invoice fee should be applied when invoicing the parking session or not
entry_event Event
exit_event Event
permit Permit
Event
time datetime (ISO 8601) Time when the event occurred
confidence integer Confidence of the camera image accuracy on the scale of 0-1000
lane string Lane on which the camera that captured the event was situated
image_url string URL of the image file
Permit
permit_name string Name of the permit used
permit_holder string Name of the permit holder
concurrent_parking_limit_exeeded boolean Marker whether the concurrent parking limit was exceeded or not
resolution string Short description on how the permit was used
OperatorData
digipost string Additional operator data, for example digipost
Summary
total results integer Total number of results returned
more_results boolean Is there more results matching the path parameters
cursor string Cursor string to fetch the next batch of results if the are more

Example success response

    
    {
        "invoices": [
            {
                "id": "1423",
                "status": "PAID",
                "operator": "onepark_no",
                "invoice_date": "2019-01-04",
                "created_at": "2020-02-22T08:20:09+0000",
                "updated_at": "2020-02-25T10:34:14+0000",
                "currency": "NOK",
                "client": {
                    "type": "TENANT",
                    "email": "foo@example.com",
                    "name": "Owner of KKRCC"
                },
                "items": [
                    {
                        "id": "1585",
                        "description": "Central Station Short Time - #21427\n01.01.19 11:45 - 01.01.19 15:05\nKKRCC  - alle plasser benyttet",
                        "parking_session": {
                            "id": "2833753",
                            "start_time": "2019-01-01T10:45:13+0000",
                            "end_time": "2019-01-01T14:05:13+0000",
                            "zone_name": "Central Station (kontoret)",
                            "zone_code": "100",
                            "vehicle_reg": "KKRCC",
                            "vehicle_nationality": "NOR",
                            "product_name": "Product name11",
                            "invoicing_fee": true,
                            "entry_event": {
                                "time": "2019-01-01T10:45:13+0000",
                                "confidence": 1000,
                                "lane": "lane1",
                                "image_url": "https://www.example.com/link_to_image.png"
                            },
                            "exit_event": {
                                "time": "2019-01-01T14:05:13+0000",
                                "confidence": 1000,
                                "lane": "lane2",
                                "image_url": "https://www.example.com/link_to_image.png"
                            }
                        },
                        "vat_percent":10.5,
                        "net_cost":19.14,
                        "vat_amount":2.01,
                        "gross_cost":21.15,
                        "accounting_object": ""
                    }
                ],
                "payments": [
                    {
                        "id": "1414",
                        "paid_at": "2019-01-04T11:28:01+0000",
                        "paid_amount": 26.50,
                        "sender_account": "0004",
                        "transaction_id": "0ea95a0fb8e84338a116b01e2e590e54",
                        "message": " OK ",
                        "payment_channel": "Nets CC payment"
                    }
                ]
            },
            {
                "id": "1429",
                "status": "UNPAID",
                "operator": "onepark_no",
                "invoice_date": "2019-01-06",
                "currency": "NOK",
                "client": {
                    "id": "123piu21b4u1",
                    "type": "TENANT",
                    "email": "foo@example.com",
                    "name": "Central Station Small Corp AS",
                    "address": "Small street 101",
                    "postal_code": "123456",
                    "company_number": "02839129",
                    "city": "Small city",
                    "reference": "12345"
                },
                "items": [
                    {
                        "id": "1589",
                        "description": "External pricing test product - #21433\n04.01.19 15:00 - 04.01.19 18:34\nKKRCC  - alle plasser benyttet",
                        "parking_session": {
                            "id": "2833754",
                            "start_time": "2019-01-04T14:00:40+0000",
                            "end_time": "2019-01-04T17:34:40+0000",
                            "zone_name": "Central Station (kontoret)",
                            "zone_code": "100",
                            "vehicle_reg": "KKRCC",
                            "vehicle_nationality": "NOR",
                            "product_name": "Product name12",
                            "invoicing_fee": false,
                            "entry_event": {
                                "time": "2019-01-04T14:00:40+0000",
                                "confidence": 1000,
                                "lane": "lane",
                                "image_url": "https://www.example.com/link_to_image.png"
                            },
                            "exit_event": {
                                "time": "2019-01-04T16:34:40+0000",
                                "confidence": 1000,
                                "lane": "lane",
                                "image_url": "https://www.example.com/link_to_image.png"
                            },
                            "permit": {
                                "permit_name": "Contract service 604",
                                "permit_holder": "Holder of this permit",
                                "concurrent_parking_limit_exceeded": false,
                                "resolution": "service used"
                            }
                        },
                        "vat_percent":10.5,
                        "net_cost":19.14,
                        "vat_amount":2.01,
                        "gross_cost":21.15,
                        "accounting_object": ""
                    }
                ],
                "payments": []
            }
        ],
        "summary": {
            "total_results": 2,
            "more_results": false
        }
    }
    
    

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
accounting_missing_scope_error Missing scope for specified status
accounting_unexpected_error Unexpected authorization error
accounting_service_invalid_to_date_error to_date should not be in the future
accounting_service_invalid_date_error Can search either by 'from' and 'to' OR 'updated_at_from' and 'updated_at_to'
operator_not_found_error Operator not found