WellPack API - v1 (1.0.0)

Download OpenAPI specification:Download

How to use this API

This API lets you analyze areas.

The creation of new areas consumes credits.

Authentication

To call this API, you need an API key provided by Seiki. The API key is provided in every HTTP call in the key header.

Here is an example in Python:

requests.get(
    'https://api.wellpack.seiki.co/v1/account/credits',
    headers = {'key': MY_API_KEY}
)

In case of failed authentication, the API returns the following status codes:

  • 401: No API key was provided
  • 403: The provided API key is not authorized to access this API

Credits

To use this API, you need credits in order to analyze areas: 1 call = 1 area = 1 credit.

To retrieve your amount of credits, you can call the endpoint /account/credits.

In case of insufficient credits, the API returns a status code 402.

For the endpoints that analyse areas, the optional boolean parameter dry_run can be provided, which allows you to check authentication and parameters validity at no cost. It also allows you to retrieve what would be the cost of the computation.

Here's the workflow when you create areas:

  • Check authentication
  • Check parameters validity
  • Compute the projected cost: 1 credit, except for the free input
  • Check that you have enough credits
  • If it's a dry run, stop here
  • Consume projected cost
  • Perform computation
  • If the computation could not be performed on an area and returns an error, this call is refunded

Basic Example

The endpoint /area_analysis lets you analyze a single new area. This endpoint is asynchronous; when submitting your inputs, the API immediately returns an ID. You can then query the API with this ID to check the analysis processing state and retrieve the output when done.

MY_ID = requests.post(
    'https://api.wellpack.seiki.co/v1/area_analysis',
    headers = {'key': MY_API_KEY},
    json = {
            "period_start": "2024-12-01",
            "period_end": "2024-12-31",
            "method": {
                "include_or_exclude_buffer": None,
                "limit_pop": 0.8
            },
            "target": {
                "trip_purpose": None,
                "modes": [
                    "VEHICULES", "MODES_DOUX"
                ],
                "frequency_min": 10,
                "frequency_max": 12,
                "genders": None,
                "ages": ["20-24", "25-29", "30-34"],
                "socio_professional_categories": [
                    "CSP_PLUS"
                ]
            },
            "geometries": [
                {
                    "coordinates": [
                        [
                            [2.313427004839639, 48.877268699116286],
                            [2.3134507995291074, 48.87707178022791],
                            [2.3147852850287336, 48.877121336047594],
                            [2.3147733876846246, 48.87731564655172],
                            [2.313427004839639, 48.877268699116286]
                        ]
                    ],
                    "type": "Polygon"
                }
            ]
        }
).json()["id"]

To retrieve the state and/or output of your id, you can use the following code:

requests.get(
    'https://api.wellpack.seiki.co/v1/area_analysis/' + MY_ID,
    headers = {'key': MY_API_KEY}
)

The output contains all information on the area, including the generated ID and its data.

To wait until a job is done, you can use the following code:

import time
import requests

status_code = 202

while status_code == 202:
    time.sleep(5)  # Wait 5 seconds
    response = requests.get(
        'https://api.wellpack.seiki.co/v1/area_analysis/' + MY_ID,
        headers = {'key': MY_API_KEY}
    )
    status_code = response.status_code

print(response.json())

The results of the area analysis remain available for 48 hours after 'the post', after this period it will no longer be possible to retrieve the data.

Account

Get credits information

This route allows you to check your remaining credits.

Authorizations:
API_KEY

Responses

Request samples

requests.get(
  'https://api.wellpack.seiki.co/v1/account/credits',
  headers = { 'key': MY_API_KEY }
)

Response samples

Content type
application/json
{
  • "credits": 42
}

Analysis

Make a new analysis on an area

This route allows you to compute a single new area analysis, in an asynchronous way. The area can be described as a list of POI(s) or Zone(s), and is represented by a geometry in GeoJSON format.

Costs 1 credit.

Authorizations:
API_KEY
query Parameters
dry_run
boolean
Default: false

Perform a dry run: only checks authorization and parameters, at no credit cost

Request Body schema: application/json
required
period_start
string or null <date>
Default: "2024-01-01"

The start date of the analysis

period_end
string or null <date>
Default: "2024-12-31"

The end date of the analysis

object
object
Array of objects

List (which can be a single item) of POI(s) or ZONE(s) (geometry GeoJSON format) of interest to be analyzed

Responses

Request samples

Content type
application/json
{
  • "period_start": "2024-09-28",
  • "period_end": "2024-10-14",
  • "method": {
    },
  • "target": {
    },
  • "geometries": [
    ]
}

Response samples

Content type
application/json
{
  • "consumed_credits": 1,
  • "id": "03ba5aac-7b56-4f37-96a9-c21b5a6fd20c"
}

Get the data from the area analysis

Authorizations:
API_KEY
path Parameters
id
required
string

The ID of the location job

Responses

Request samples

requests.get(
  'https://api.wellpack.seiki.co/v1/area_analysis/<id>',
  headers = { 'key': MY_API_KEY }
)

Response samples

Content type
application/json
{
  • "state": "FAILURE | RUNNING | SUCCESS",
  • "cost": 1,
  • "refund": 0,
  • "items": {
    }
}

Reference Data

Get all genders

Authorizations:
API_KEY

Responses

Response samples

Content type
application/json
{
  • "items": [
    ]
}

Get all ages

Authorizations:
API_KEY

Responses

Response samples

Content type
application/json
{
  • "items": [
    ]
}

Get all social groups

Authorizations:
API_KEY

Responses

Response samples

Content type
application/json
{
  • "items": [
    ]
}

Get all modes

Authorizations:
API_KEY

Responses

Response samples

Content type
application/json
{
  • "items": [
    ]
}

Get all the trip purposes

Authorizations:
API_KEY

Responses

Response samples

Content type
application/json
{
  • "items": [
    ]
}