API Introduction

Starting guide for the 1Pilot REST API

Generate Access Token

To use the API you need to have an Access Token, you can generate one from your Profile page by clicking the "Create New Token" button.

On the modal, set a name and choose if this token will have Write access to the API (write access means you can create sites and tags via the API) once this is done, click on the create button and save the token in a safe place: this is the only time it will be shown.

Authentication

All requests through the API must be authenticated using the previously generated token.

The token must be passed as a bearer token in the "Authorization" HTTP header as following :

Authorization: Bearer $TOKEN

API endpoint

Our API is available at the following base URI: https://app.1pilot.io/api/v1

Test Call

GET /ping

A simple ping endpoint that you can use to test if you're correctly authenticated.

curl -X GET https://app.1pilot.io/api/v1/ping \
    -H "Accept: application/json" \
    -H "Authorization: Bearer $TOKEN"
Headers
Authorization Authentication Token
value: Bearer $TOKEN
Accept application/json

Responses

HTTP 200 You are successfully authenticated.

{ 
    "message": "pong"
}
HTTP 401 You have not provided the Authorization header or the provided one is not valid.

{
    "message": "Unauthenticated."
}

Pagination

All list results are paginated with "links" & "meta" informations in the response body

{ 
    "data": [
        [...]
    ], 
    "links": { 
        "first": "https://app.1pilot.io/api/v1/sites/1/logs?page=1", 
        "last": "https://app.1pilot.io/api/v1/sites/1/logs?page=4", 
        "prev": "https://app.1pilot.io/api/v1/sites/1/logs?page=1", 
        "next": "https://app.1pilot.io/api/v1/sites/1/logs?page=3" 
    }, 
    "meta": { 
        "current_page": 2, 
        "from": 16, 
        "last_page": 4, 
        "path": "https://app.1pilot.io/api/v1/sites/1/logs", 
        "per_page": 15, 
        "to": 30, 
        "total": 53 
    } 
}

You can use the page query parameter to follow the pagination.