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 Autopay, the operator should specify what kind of access is needed.
GET - Get invoices
This service allows you to retrieve all invoices within 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
orinvoice_date_to
parameter from the previous request asfrom
orinvoice_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=2023-05-19T12:15:00%2B0200&to=2023-05-26T12:15:00%2B0200&status=PAID&cursor=CkIKGAoL...
Success response
HTTP Code: 200 OK
Parameter | Type | Mandatory | Description |
---|---|---|---|
invoices | array of Invoices | yes | |
summary | Summary | yes | |
Invoice | |||
id | string | yes | ID of the invoice |
batch_id | string | no | ID of the invoice batch |
status | string | yes | Status of the invoice: PAID, UNPAID |
operator | string | yes | Operator of the Autopay location |
invoice_date | date | yes | Date when the invoice was generated |
currency | string | yes | Currency of the invoice |
receipt_url | string | no | Receipt URL |
client | Client | no | |
items | array of Items | yes | |
payments | array of Payments | yes | |
created_at | datetime (ISO 8601) | no | Date when the invoice was created |
updated_at | datetime (ISO 8601) | no | Date when the invoice was updated |
Client | |||
id | string | no | 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. |
type | string | yes | Type of the client: REGULAR |
string | no | Client contact email address | |
phone | string | no | Client telephone number |
name | string | yes | Name of the client |
address | string | no | Client billing address |
postal_code | string | no | Client postal (zip) code |
company_number | string | no | Client company number |
city | string | no | Client city |
country | string | no | Client country |
birth_date | date | no | Client birth date |
operator_data | OperatorData | no | Operator data is a custom JSON field containing the operator's custom elements that need to be forwarded to the Accounting API |
reference | string | no | Reference field from tenants billing data |
Item | |||
id | string | yes | ID of the invoice item |
description | string | yes | Short description of item origins based on operator-specific template |
parking_session | ParkingSession | no | |
charging_session | ChargingSession | no | |
vat_percent | decimal | yes | VAT percent applied to item amount |
net_price | decimal | yes | Price of the invoice item without VAT |
gross_price | decimal | yes | Price of the invoice item with VAT |
vat_amount | decimal | yes | VAT amount included in the price |
accounting_object | string | no | Unique code used in accounting systems |
Payment | |||
id | string | yes | ID of the payment |
paid_at | datetime (ISO 8601) | yes | Time of the payment |
paid_amount | decimal | yes | Amount paid |
sender_account | string | no | Account used for payment |
transaction_id | string | no | ID of the transaction, returned by the payment provider |
message | string | no | Transaction message, returned by the payment provider |
payment_channel | string | no | Payment channel used for the payment |
autopay_payment_reference | string | no | Reference number in autopay.io for the payment |
payment_provider | PaymentProvider | no | |
PaymentProvider | |||
name | string | no | Name of the provider responsible for handling the payment |
code | string | yes | Unique code of the payment provider |
ParkingSession | |||
id | string | yes | ID of the parking session |
invoicing_fee | boolean | no | Marker of whether the invoice fee should be applied when invoicing the parking session or not |
start_time | datetime (ISO 8601) | yes | Start time of the parking session related to the invoice item (Provided in UTC timezone) |
end_time | datetime (ISO 8601) | yes | End time of the parking session related to the invoice item (Provided in UTC timezone) |
zone_name | string | yes | Name of the zone related to the parking session |
zone_code | string | yes | Code of the zone related to the parking session |
facility_name | string | no | Name of the facility related to the parking session |
facility_code | string | no | Code of the facility related to the parking session |
vehicle_reg | string | yes | Vehicle registration (number plate) of the vehicle parked |
vehicle_nationality | string | no | Nationality (country code) of the vehicle parked |
vehicle_region | string | no | Region (subdivision) of the vehicle parked |
entry_event | Event | no | |
exit_event | Event | no | |
permit | Permit | no | |
product_name | string | yes | Product name used for parking |
ChargingSession | |||
id | string | yes | ID of the charging session |
start_time | datetime (ISO 8601) | yes | Start time of the charging session related to the invoice item (Provided in UTC timezone) |
end_time | datetime (ISO 8601) | yes | End time of the charging session related to the invoice item (Provided in UTC timezone) |
zone_name | string | yes | Name of the zone related to the charging session |
zone_code | string | yes | Code of the zone related to the charging session |
facility_name | string | no | Name of the facility related to the charging session |
facility_code | string | no | Code of the facility related to the charging session |
vehicle_reg | string | no | Vehicle registration (number plate) of the vehicle charging |
vehicle_nationality | string | no | Nationality (country code) of the vehicle charging |
vehicle_region | string | no | Region (subdivision) of the vehicle charging |
product_name | string | no | Product name used for charging |
kwh_charged | decimal | no | Amount of kwh consumed while charging |
Event | |||
time | datetime (ISO 8601) | yes | Time when the event occurred (Provided in UTC timezone) |
confidence | integer | yes | Confidence of the camera image accuracy on the scale of 0-1000 |
lane | string | no | Lane on which the camera that captured the event was situated |
image_url | string | no | URL of the image file |
Permit | |||
permit_name | string | yes | Name of the permit used |
permit_holder | string | no | Name of the permit holder |
concurrent_parking_limit_exceeded | boolean | yes | Marker whether the concurrent parking limit was exceeded or not |
resolution | string | yes | Short description on how the permit was used |
OperatorData | |||
digipost | string | no | Additional operator data, for example digipost |
Summary | |||
total_results | integer | yes | Total number of results returned |
more_results | boolean | yes | Is there more results matching the path parameters |
cursor | string | no | Cursor string to fetch the next batch of results if the are more |
Example success response
{
"invoices": [
{
"id": "1423onepark_no",
"status": "PAID",
"operator": "onepark_no",
"invoice_date": "2023-05-20",
"currency": "NOK",
"receipt_url": "https://receipt.autopay.io/34b3c99f-7bda-43f2-a298-9db4e847f38e.pdf",
"client": {
"id": "ZZZxvBgjdZXZUcE8H4otDIRXnFf9",
"type": "REGULAR",
"email": "foo@example.com",
"phone": "123456789",
"name": "Central Station Small Corp AS",
"address": "Small street 101",
"postal_code": "123456",
"company_number": "02839129",
"city": "Oslo",
"country": "NO",
"birth_date": "1980-01-01",
"reference": "12345",
},
"items": [
{
"id": "1234567898765432",
"description": "Central Station 4h Product - #21412\n20.05.23 11:45 - 20.05.23 15:05\nKKRCC - alle plasser benyttet",
"parking_session": {
"id": "2833",
"start_time": "2023-05-20T10:45:13+0000",
"end_time": "2023-05-20T14:05:13+0000",
"zone_name": "Central Station (kontoret)",
"zone_code": "100",
"facility_name": "The Central Station",
"facility_code": "1",
"vehicle_reg": "KKRCC",
"vehicle_nationality": "NO",
"entry_event": {
"time": "2023-05-20T10:45:13+0000",
"confidence": 1000,
"lane": "IN"
},
"exit_event": {
"time": "2023-05-20T14:05:13+0000",
"confidence": 1000,
"lane": "OUT"
},
"product_name": "Central Station 4h Product",
},
"vat_percent":20.0,
"net_price":90.0,
"gross_price":108.0,
"vat_amount":18.0,
"accounting_object": "54321"
}
],
"payments": [
{
"id": "1414",
"paid_at": "2023-05-21T11:28:01+0000",
"paid_amount": 108.0,
"sender_account": "0001",
"transaction_id": "0ea95a0fb8e84338a116b01e2e590e54",
"message": " OK ",
"payment_channel": "PaymentWeb CC payment",
"autopay_payment_reference": "xzecW9eJE",
"payment_provider": {
"name": "Secure Bank",
"code": "SEBA"
}
}
],
"created_at": "2023-05-21T12:20:09+0000",
"updated_at": "2023-05-21T12:21:14+0000",
},
{
"id": "1425onepark_no",
"status": "PAID",
"operator": "onepark_no",
"invoice_date": "2023-05-22",
"currency": "NOK",
"receipt_url": "https://receipt.autopay.io/34b3c98f-7bda-43f2-a298-9db4e847f38f.pdf",
"client": {
"id": "abCdeKqWXxVNPLnT3ClYkt99x987",
"type": "REGULAR",
"email": "bar@example.com",
"phone": "987654321",
"name": "Melissa Gorges",
"postal_code": "123456",
"country": "NO",
"birth_date": "1985-12-31"
"operator_data": {
"digipost": "melissa.gorges#4321"
},
"reference": "12345",
},
"items": [
{
"id": "1234567898765433",
"description": "Central Station EV charging - #21427\n22.05.23 11:45 - 22.05.23 15:05\nKKRCC - alle plasser benyttet",
"charging_session": {
"id": "cedc777c-eb83-43e1-a031-b276d3f14279",
"start_time": "2023-05-22T10:45:13+0000",
"end_time": "2023-05-22T14:05:13+0000",
"zone_name": "Central Station (kontoret)",
"zone_code": "100",
"facility_name": "Central Station",
"facility_code": "1",
"vehicle_reg": "JJPZZ",
"product_name": "Central Station EV charging",
"kwh_charged": 10.203
},
"vat_percent": 25.0,
"net_price": 67.8,
"gross_price": 84.75,
"vat_amount": 16.95,
"accounting_object": "54322"
},
{
"id": "service-charge",
"description": "Service charge",
"vat_percent": 25.0,
"net_price": 1.6,
"gross_price": 2.0,
"vat_amount": 0.4,
"accounting_object": "12346"
}
],
"payments": [
{
"id": "I8ytr7u55",
"paid_at": "2023-05-22T15:28:01+0000",
"paid_amount": 86.75,
"sender_account": "0096",
"transaction_id": "123f567yb247f1b879be1551db27d9",
"payment_channel": "Nets CC payment",
"autopay_payment_reference": "fYlLoXqRm"
}
],
"created_at": "2023-05-22T15:30:09+0000",
"updated_at": "2023-05-22T15:30:14+0000",
},
{
"id": "1429onepark_no",
"batch_id": "T3st4u70paY1",
"status": "UNPAID",
"operator": "onepark_no",
"invoice_date": "2023-05-25",
"currency": "NOK",
"items": [
{
"id": "1234567898765434",
"description": "Central Station 4h product - #21433\n25.05.23 15:00 - 25.05.23 18:34\nKKRCC - alle plasser benyttet",
"parking_session": {
"id": "7cd66bcb-2dd3-4a7e-8aee-4323384503d3",
"invoicing_fee": false,
"start_time": "2023-05-25T14:00:40+0000",
"end_time": "2023-05-25T17:34:40+0000",
"zone_name": "Central Station (kontoret)",
"zone_code": "100",
"facility_name": "Central Station",
"facility_code": "1",
"vehicle_reg": "DDYUU",
"vehicle_nationality": "NO",
"entry_event": {
"time": "2023-05-25T14:00:40+0000",
"confidence": 900,
"lane": "IN",
"image_url": "https://www.example.com/link_to_image.png"
},
"exit_event": {
"time": "2023-05-25T17:34:40+0000",
"confidence": 900,
"lane": "OUT",
"image_url": "https://www.example.com/link_to_image.png"
},
"permit": {
"permit_name": "Contract permit #1",
"permit_holder": "Holder of this permit",
"concurrent_parking_limit_exceeded": false,
"resolution": "permit used"
},
"product_name": "Central Station 4h product",
},
"vat_percent": 20.0,
"net_price": 95.0,
"gross_price": 114.0,
"vat_amount": 19.0
}
],
"payments": [],
"created_at": "2023-05-25T19:30:09+0000",
"updated_at": "2023-05-25T19:30:14+0000",
}
],
"summary": {
"total_results": 3,
"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 |