Skip to main content
POST
/
v1
/
risk-score
/
ppa-telematics
Queue Risk Score Calculation
curl --request POST \
  --url https://api.example.com/v1/risk-score/ppa-telematics \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: multipart/form-data' \
  --form file='@example-file' \
  --form 'version=<string>' \
  --form 'policy_holder_id=<string>'
import requests

url = "https://api.example.com/v1/risk-score/ppa-telematics"

files = { "file": ("example-file", open("example-file", "rb")) }
payload = {
"version": "<string>",
"policy_holder_id": "<string>"
}
headers = {"Authorization": "Bearer <token>"}

response = requests.post(url, data=payload, files=files, headers=headers)

print(response.text)
const form = new FormData();
form.append('file', '<string>');
form.append('version', '<string>');
form.append('policy_holder_id', '<string>');

const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};

options.body = form;

fetch('https://api.example.com/v1/risk-score/ppa-telematics', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/v1/risk-score/ppa-telematics",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"version\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"policy_holder_id\"\r\n\r\n<string>\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: multipart/form-data"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://api.example.com/v1/risk-score/ppa-telematics"

payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"version\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"policy_holder_id\"\r\n\r\n<string>\r\n-----011000010111000001101001--")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("Authorization", "Bearer <token>")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://api.example.com/v1/risk-score/ppa-telematics")
.header("Authorization", "Bearer <token>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"version\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"policy_holder_id\"\r\n\r\n<string>\r\n-----011000010111000001101001--")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.example.com/v1/risk-score/ppa-telematics")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"version\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"policy_holder_id\"\r\n\r\n<string>\r\n-----011000010111000001101001--"

response = http.request(request)
puts response.read_body
{
  "job_id": "<string>",
  "error_message": ""
}
{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

multipart/form-data
file
file
required

Expected CSV Format

  1. Filename & Format

    • Must be a CSV file (.csv extension).
    • The file cannot be empty and cannot contain rows with null (empty) values.
  2. Required Columns

    • latitude (float) WGS84 format (e.g. 37.7749)
    • longitude (float) WGS84 format (e.g. -122.4194)
    • timestamp (datetime in ISO 8601 format, e.g. 2023-01-15T13:45:30Z)

    Optional Column

    • vehicle_id (string,integer or null) if not provided, the vehicle_id will be set to vehicle_1

    You can download a sample file here.

  3. Data Validation & Constraints

    • Extra columns are ignored.
    • Every row must have valid values in each required column (no nulls or missing values).
    • latitude and longitude are used to join external risk data, so they should be accurate real-world coordinates in WGS84 format.
    • timestamp must be parseable in strict ISO 8601 format.
    • Files failing these validations are rejected.
    • The file must be less than 1GB.
    • Files are deleted after request is processed.
version
string
required

Version of the risk scoring model used.

Allowed value: "v1"
Example:

"v1"

policy_holder_id
string
required

Unique identifier for the policyholder.

Example:

"policy-holder-123"

Response

Successful Response

job_id
string
required

Unique identifier for the batch job

Example:

"job_2fb5792c"

status
enum<string>
required

Current status of the job

Available options:
pending,
processing,
completed,
failed,
expired
error_message
string | null
required

Error message if job failed

Example:

""