HTTP API

Surge Pricing

POST/api/v1/surge-pricing/calculate
POST
/api/v1/surge-pricing/calculate

Authorization

bearer_token
AuthorizationBearer <token>

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

curl -X POST "https://example.com/api/v1/surge-pricing/calculate" \  -H "Content-Type: application/json" \  -d '{    "context": null,    "items": [      {        "base_price": 0.1,        "item_id": "string"      }    ],    "policy_id": "string"  }'
{  "results": [    {      "currency": "string",      "explanation": [        {          "effect": "string",          "result": 0.1,          "rule": "string"        }      ],      "final_price": 0.1,      "item_id": "string",      "trace_id": "string"    }  ],  "trace_id": "string"}
POST/api/v1/surge-pricing/lookup-tables
POST
/api/v1/surge-pricing/lookup-tables

Authorization

bearer_token
AuthorizationBearer <token>

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

curl -X POST "https://example.com/api/v1/surge-pricing/lookup-tables" \  -H "Content-Type: application/json" \  -d '{    "data": null,    "table_name": "string"  }'
{  "entries": 0,  "table_name": "string"}
GET/api/v1/surge-pricing/lookup-tables/{table_name}
GET
/api/v1/surge-pricing/lookup-tables/{table_name}

Authorization

bearer_token
AuthorizationBearer <token>

In: header

Path Parameters

table_name*string

Lookup table name

Response Body

application/json

curl -X GET "https://example.com/api/v1/surge-pricing/lookup-tables/string"
{  "data": null,  "table_name": "string"}
GET/api/v1/surge-pricing/metrics
GET
/api/v1/surge-pricing/metrics

Authorization

bearer_token
AuthorizationBearer <token>

In: header

Response Body

application/json

curl -X GET "https://example.com/api/v1/surge-pricing/metrics"
{  "metrics": [    "string"  ]}
POST/api/v1/surge-pricing/metrics
POST
/api/v1/surge-pricing/metrics

Authorization

bearer_token
AuthorizationBearer <token>

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

curl -X POST "https://example.com/api/v1/surge-pricing/metrics" \  -H "Content-Type: application/json" \  -d '{    "metric_name": "string",    "value": null  }'
{  "metric_name": "string",  "timestamp": 0}
GET/api/v1/surge-pricing/metrics/{metric_name}
GET
/api/v1/surge-pricing/metrics/{metric_name}

Authorization

bearer_token
AuthorizationBearer <token>

In: header

Path Parameters

metric_name*string

Metric name

Response Body

application/json

curl -X GET "https://example.com/api/v1/surge-pricing/metrics/string"
{  "metric_name": "string",  "timestamp": 0,  "value": null}
GET/api/v1/surge-pricing/policies
GET
/api/v1/surge-pricing/policies

Authorization

bearer_token
AuthorizationBearer <token>

In: header

Query Parameters

q?string

Full-text search query applied to policy description

page?integer

1-indexed page number

Formatint64
Range0 <= value
page_size?integer

Page size

Formatint64
Range0 <= value
sort_by?string

Sort field (created_at, updated_at, version)

sort_order?string

Sort order (asc or desc)

Value in

  • "asc"
  • "desc"
filter?array<string>

Filter expressions in the form field:operator:value Available filters: deleted, version

include_deleted?boolean

Include deleted policies (default: false)

Response Body

application/json

curl -X GET "https://example.com/api/v1/surge-pricing/policies"
{  "pagination": {    "has_more": true,    "page": 0,    "page_size": 0,    "total": 0  },  "policies": [    {      "deleted": true,      "description": "string",      "policy_id": "string",      "rule_count": 0,      "updated_at": 0,      "version": 0    }  ]}
POST/api/v1/surge-pricing/policies
POST
/api/v1/surge-pricing/policies

Authorization

bearer_token
AuthorizationBearer <token>

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

curl -X POST "https://example.com/api/v1/surge-pricing/policies" \  -H "Content-Type: application/json" \  -d '{    "description": "string",    "policy_id": "string",    "rules": [      {        "conditions": [          {            "field": "string",            "operator": "equals",            "value": null          }        ],        "name": "string",        "params": {},        "rule_type": "set_from_lookup"      }    ]  }'
{  "policy": {    "created_at": 0,    "deleted": true,    "description": "string",    "policy_id": "string",    "rules": [      {        "conditions": [          {            "field": "string",            "operator": "equals",            "value": null          }        ],        "enabled": true,        "name": "string",        "params": {          "amount": 0,          "charm_ending": 0,          "fixed_price": 0,          "key_field": "string",          "lookup_table": "string",          "multiplier": 0,          "multiplier_field": "string",          "percentage": 0        },        "rule_type": "set_from_lookup"      }    ],    "updated_at": 0,    "version": 0  }}
GET/api/v1/surge-pricing/policies/{policy_id}
GET
/api/v1/surge-pricing/policies/{policy_id}

Authorization

bearer_token
AuthorizationBearer <token>

In: header

Path Parameters

policy_id*string

Policy ID

Query Parameters

version?integer

Policy version (defaults to active)

Formatint32
Range0 <= value

Response Body

application/json

curl -X GET "https://example.com/api/v1/surge-pricing/policies/string"
{  "policy": {    "created_at": 0,    "deleted": true,    "description": "string",    "policy_id": "string",    "rules": [      {        "conditions": [          {            "field": "string",            "operator": "equals",            "value": null          }        ],        "enabled": true,        "name": "string",        "params": {          "amount": 0,          "charm_ending": 0,          "fixed_price": 0,          "key_field": "string",          "lookup_table": "string",          "multiplier": 0,          "multiplier_field": "string",          "percentage": 0        },        "rule_type": "set_from_lookup"      }    ],    "updated_at": 0,    "version": 0  }}
DELETE/api/v1/surge-pricing/policies/{policy_id}
DELETE
/api/v1/surge-pricing/policies/{policy_id}

Authorization

bearer_token
AuthorizationBearer <token>

In: header

Path Parameters

policy_id*string

Policy ID

Response Body

application/json

curl -X DELETE "https://example.com/api/v1/surge-pricing/policies/string"
{  "deleted": true,  "policy_id": "string"}
PUT/api/v1/surge-pricing/policies/{policy_id}
PUT
/api/v1/surge-pricing/policies/{policy_id}

Authorization

bearer_token
AuthorizationBearer <token>

In: header

Path Parameters

policy_id*string

Policy ID

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

curl -X PUT "https://example.com/api/v1/surge-pricing/policies/string" \  -H "Content-Type: application/json" \  -d '{    "rules": [      {        "conditions": [          {            "field": "string",            "operator": "equals",            "value": null          }        ],        "name": "string",        "params": {},        "rule_type": "set_from_lookup"      }    ]  }'
{  "policy": {    "created_at": 0,    "deleted": true,    "description": "string",    "policy_id": "string",    "rules": [      {        "conditions": [          {            "field": "string",            "operator": "equals",            "value": null          }        ],        "enabled": true,        "name": "string",        "params": {          "amount": 0,          "charm_ending": 0,          "fixed_price": 0,          "key_field": "string",          "lookup_table": "string",          "multiplier": 0,          "multiplier_field": "string",          "percentage": 0        },        "rule_type": "set_from_lookup"      }    ],    "updated_at": 0,    "version": 0  },  "previous_version": 0}
GET/api/v1/surge-pricing/policies/{policy_id}/history
GET
/api/v1/surge-pricing/policies/{policy_id}/history

Authorization

bearer_token
AuthorizationBearer <token>

In: header

Path Parameters

policy_id*string

Policy ID

Response Body

application/json

curl -X GET "https://example.com/api/v1/surge-pricing/policies/string/history"
{  "active_version": 0,  "policy_id": "string",  "versions": [    {      "description": "string",      "updated_at": 0,      "version": 0    }  ]}
POST/api/v1/surge-pricing/policies/{policy_id}/rollback
POST
/api/v1/surge-pricing/policies/{policy_id}/rollback

Authorization

bearer_token
AuthorizationBearer <token>

In: header

Path Parameters

policy_id*string

Policy ID

Query Parameters

version*integer

Target version to rollback to

Formatint32
Range0 <= value

Response Body

application/json

curl -X POST "https://example.com/api/v1/surge-pricing/policies/string/rollback?version=0"
{  "policy": {    "created_at": 0,    "deleted": true,    "description": "string",    "policy_id": "string",    "rules": [      {        "conditions": [          {            "field": "string",            "operator": "equals",            "value": null          }        ],        "enabled": true,        "name": "string",        "params": {          "amount": 0,          "charm_ending": 0,          "fixed_price": 0,          "key_field": "string",          "lookup_table": "string",          "multiplier": 0,          "multiplier_field": "string",          "percentage": 0        },        "rule_type": "set_from_lookup"      }    ],    "updated_at": 0,    "version": 0  }}
POST/api/v1/surge-pricing/policies/{policy_id}/simulate
POST
/api/v1/surge-pricing/policies/{policy_id}/simulate

Authorization

bearer_token
AuthorizationBearer <token>

In: header

Path Parameters

policy_id*string

Policy ID

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

curl -X POST "https://example.com/api/v1/surge-pricing/policies/string/simulate" \  -H "Content-Type: application/json" \  -d '{    "base_price": 0.1,    "contexts": [      null    ]  }'
{  "base_price": 0.1,  "policy_id": "string",  "results": [    {      "context_index": 0,      "currency": "string",      "explanation": [        {          "effect": "string",          "result": 0.1,          "rule": "string"        }      ],      "final_price": 0.1    }  ],  "version": 0}
GET/api/v1/surge-pricing/trace/{trace_id}
GET
/api/v1/surge-pricing/trace/{trace_id}

Authorization

bearer_token
AuthorizationBearer <token>

In: header

Path Parameters

trace_id*string

Trace ID

Response Body

application/json

curl -X GET "https://example.com/api/v1/surge-pricing/trace/string"
{  "currency": "string",  "explanation": [    {      "effect": "string",      "result": 0.1,      "rule": "string"    }  ],  "final_price": 0.1,  "item_id": "string",  "trace_id": "string"}

On this page