HTTP API

Chrono

GET/api/v1/chrono/analytics/{resource_id}
GET
/api/v1/chrono/analytics/{resource_id}

Authorization

bearer_token
AuthorizationBearer <token>

In: header

Path Parameters

resource_id*string

Query Parameters

window?string

Window expression such as 7d, 24h (informational; analytics are computed live).

Response Body

application/json

curl -X GET "https://example.com/api/v1/chrono/analytics/string"
{  "active_states": 0,  "at_cap": 0,  "at_zero": 0,  "average_value": 0.1,  "resource_id": "string",  "window": "string"}
GET/api/v1/chrono/definitions
GET
/api/v1/chrono/definitions

Authorization

bearer_token
AuthorizationBearer <token>

In: header

Query Parameters

page?integer

1-indexed page number.

Formatint64
Range0 <= value
page_size?integer

Page size.

Formatint64
Range0 <= value
sort_order?string

Sort order by created_at (asc or desc).

Value in

  • "asc"
  • "desc"

Response Body

application/json

curl -X GET "https://example.com/api/v1/chrono/definitions"
{  "definitions": [    {      "cap": 0.1,      "composition": "multiplicative",      "created_at": 0,      "curve": {        "rate_per_second": 0.1,        "round": "floor",        "type": "linear"      },      "description": "string",      "id": "string",      "initial_value": 0.1,      "name": "string",      "offers": [        {          "effect": {            "cap_extension": 0,            "duration_seconds": 0,            "permanent": true,            "refill": "string",            "regen_multiplier": 0          },          "id": "string",          "price": {            "amount": 0.1,            "currency": "string"          }        }      ],      "overflow": {        "bank_cap": 0.1,        "convert_rate": 0,        "drain_order": "value_first",        "mode": "discard"      },      "reset": {        "at_local_time": "string",        "fallback_offset_minutes": 0,        "reset_to": "cap",        "schedule": "none"      },      "tags": [        "string"      ],      "updated_at": 0,      "version": 0    }  ],  "pagination": {    "has_more": true,    "page": 0,    "page_size": 0,    "total": 0  }}
POST/api/v1/chrono/definitions
POST
/api/v1/chrono/definitions

Authorization

bearer_token
AuthorizationBearer <token>

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Create a new resource definition (admin only).

Response Body

application/json

curl -X POST "https://example.com/api/v1/chrono/definitions" \  -H "Content-Type: application/json" \  -d '{    "cap": 0.1,    "curve": {      "rate_per_second": 0.1,      "type": "linear"    },    "id": "string",    "initial_value": 0.1,    "name": "string"  }'
{  "cap": 0.1,  "composition": "multiplicative",  "created_at": 0,  "curve": {    "rate_per_second": 0.1,    "round": "floor",    "type": "linear"  },  "description": "string",  "id": "string",  "initial_value": 0.1,  "name": "string",  "offers": [    {      "effect": {        "cap_extension": 0,        "duration_seconds": 0,        "permanent": true,        "refill": "string",        "regen_multiplier": 0      },      "id": "string",      "price": {        "amount": 0.1,        "currency": "string"      }    }  ],  "overflow": {    "bank_cap": 0.1,    "convert_rate": 0,    "drain_order": "value_first",    "mode": "discard"  },  "reset": {    "at_local_time": "string",    "fallback_offset_minutes": 0,    "reset_to": "cap",    "schedule": "none"  },  "tags": [    "string"  ],  "updated_at": 0,  "version": 0}
GET/api/v1/chrono/definitions/{resource_id}
GET
/api/v1/chrono/definitions/{resource_id}

Authorization

bearer_token
AuthorizationBearer <token>

In: header

Path Parameters

resource_id*string

Response Body

application/json

curl -X GET "https://example.com/api/v1/chrono/definitions/string"
{  "cap": 0.1,  "composition": "multiplicative",  "created_at": 0,  "curve": {    "rate_per_second": 0.1,    "round": "floor",    "type": "linear"  },  "description": "string",  "id": "string",  "initial_value": 0.1,  "name": "string",  "offers": [    {      "effect": {        "cap_extension": 0,        "duration_seconds": 0,        "permanent": true,        "refill": "string",        "regen_multiplier": 0      },      "id": "string",      "price": {        "amount": 0.1,        "currency": "string"      }    }  ],  "overflow": {    "bank_cap": 0.1,    "convert_rate": 0,    "drain_order": "value_first",    "mode": "discard"  },  "reset": {    "at_local_time": "string",    "fallback_offset_minutes": 0,    "reset_to": "cap",    "schedule": "none"  },  "tags": [    "string"  ],  "updated_at": 0,  "version": 0}
DELETE/api/v1/chrono/definitions/{resource_id}
DELETE
/api/v1/chrono/definitions/{resource_id}

Authorization

bearer_token
AuthorizationBearer <token>

In: header

Path Parameters

resource_id*string

Response Body

application/json

curl -X DELETE "https://example.com/api/v1/chrono/definitions/string"
{  "message": "string",  "resource_id": "string"}
PUT/api/v1/chrono/definitions/{resource_id}
PUT
/api/v1/chrono/definitions/{resource_id}

Authorization

bearer_token
AuthorizationBearer <token>

In: header

Path Parameters

resource_id*string

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Update an existing resource definition (admin only). Bumps the version.

Response Body

application/json

curl -X PUT "https://example.com/api/v1/chrono/definitions/string" \  -H "Content-Type: application/json" \  -d '{}'
{  "cap": 0.1,  "composition": "multiplicative",  "created_at": 0,  "curve": {    "rate_per_second": 0.1,    "round": "floor",    "type": "linear"  },  "description": "string",  "id": "string",  "initial_value": 0.1,  "name": "string",  "offers": [    {      "effect": {        "cap_extension": 0,        "duration_seconds": 0,        "permanent": true,        "refill": "string",        "regen_multiplier": 0      },      "id": "string",      "price": {        "amount": 0.1,        "currency": "string"      }    }  ],  "overflow": {    "bank_cap": 0.1,    "convert_rate": 0,    "drain_order": "value_first",    "mode": "discard"  },  "reset": {    "at_local_time": "string",    "fallback_offset_minutes": 0,    "reset_to": "cap",    "schedule": "none"  },  "tags": [    "string"  ],  "updated_at": 0,  "version": 0}
POST/api/v1/chrono/definitions/{resource_id}/simulate
POST
/api/v1/chrono/definitions/{resource_id}/simulate

Authorization

bearer_token
AuthorizationBearer <token>

In: header

Path Parameters

resource_id*string

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Simulate a definition against a synthetic timeline (no user state touched).

Response Body

application/json

curl -X POST "https://example.com/api/v1/chrono/definitions/string/simulate" \  -H "Content-Type: application/json" \  -d '{    "events": [      {        "at": 0      }    ]  }'
{  "resource_id": "string",  "trace": [    {      "at": 0,      "bank_value": 0.1,      "event": "string",      "value": 0.1    }  ]}
GET/api/v1/chrono/me/resources
GET
/api/v1/chrono/me/resources

Authorization

bearer_token
AuthorizationBearer <token>

In: header

Response Body

application/json

curl -X GET "https://example.com/api/v1/chrono/me/resources"
{  "states": [    {      "bank_value": 0.1,      "cap_extension": 0.1,      "converted_total": 0.1,      "created_at": "2019-08-24T14:15:22Z",      "definition_version": 0,      "id": "string",      "last_reset_at": 0,      "last_timestamp": 0,      "last_value": 0.1,      "modifiers": [        {          "expires_at": 0,          "factor": 0.1,          "id": "string",          "kind": "regen_multiplier",          "source": "string"        }      ],      "resource_id": "string",      "updated_at": "2019-08-24T14:15:22Z",      "user_id": "string"    }  ],  "user_id": "string"}
GET/api/v1/chrono/resources/{resource_id}
GET
/api/v1/chrono/resources/{resource_id}

Authorization

bearer_token
AuthorizationBearer <token>

In: header

Path Parameters

resource_id*string

Query Parameters

tz_offset_minutes?integer

Caller's UTC offset in minutes for timezone-anchored resets. Falls back to the definition's fallback_offset_minutes when absent.

Formatint32

Response Body

application/json

curl -X GET "https://example.com/api/v1/chrono/resources/string"
{  "bank_value": 0.1,  "cap": 0.1,  "converted_total": 0.1,  "modifiers": [    {      "expires_at": 0,      "factor": 0.1,      "id": "string",      "kind": "regen_multiplier",      "source": "string"    }  ],  "resource_id": "string",  "seconds_to_full": 0,  "seconds_to_next_unit": 0,  "value": 0.1}
POST/api/v1/chrono/resources/{resource_id}/materialize
POST
/api/v1/chrono/resources/{resource_id}/materialize

Authorization

bearer_token
AuthorizationBearer <token>

In: header

Path Parameters

resource_id*string

Query Parameters

tz_offset_minutes?integer

Caller's UTC offset in minutes for timezone-anchored resets. Falls back to the definition's fallback_offset_minutes when absent.

Formatint32

Response Body

application/json

curl -X POST "https://example.com/api/v1/chrono/resources/string/materialize"
{  "accrued_after_diminishing": 0.1,  "accrued_raw": 0.1,  "away_seconds": 0,  "banked_overflow": 0.1,  "clipped_by_cap": 0.1,  "converted_overflow": 0.1,  "final_value": 0.1,  "modifiers_applied": [    "string"  ],  "resource_id": "string"}
POST/api/v1/chrono/resources/{resource_id}/modifiers
POST
/api/v1/chrono/resources/{resource_id}/modifiers

Authorization

bearer_token
AuthorizationBearer <token>

In: header

Path Parameters

resource_id*string

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Attach a modifier to the caller's resource state.

Response Body

application/json

curl -X POST "https://example.com/api/v1/chrono/resources/string/modifiers" \  -H "Content-Type: application/json" \  -d '{    "duration_seconds": 0,    "factor": 0.1,    "kind": "regen_multiplier",    "source": "string"  }'
{  "modifier": {    "expires_at": 0,    "factor": 0.1,    "id": "string",    "kind": "regen_multiplier",    "source": "string"  },  "resource_id": "string"}
DELETE/api/v1/chrono/resources/{resource_id}/modifiers/{modifier_id}
DELETE
/api/v1/chrono/resources/{resource_id}/modifiers/{modifier_id}

Authorization

bearer_token
AuthorizationBearer <token>

In: header

Path Parameters

resource_id*string
modifier_id*string

Response Body

application/json

curl -X DELETE "https://example.com/api/v1/chrono/resources/string/modifiers/string"
{  "message": "string",  "modifier_id": "string",  "resource_id": "string"}
POST/api/v1/chrono/resources/{resource_id}/refill
POST
/api/v1/chrono/resources/{resource_id}/refill

Authorization

bearer_token
AuthorizationBearer <token>

In: header

Path Parameters

resource_id*string

Query Parameters

tz_offset_minutes?integer

Caller's UTC offset in minutes for timezone-anchored resets. Falls back to the definition's fallback_offset_minutes when absent.

Formatint32

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Grant or restore value on the caller's resource.

Response Body

application/json

curl -X POST "https://example.com/api/v1/chrono/resources/string/refill" \  -H "Content-Type: application/json" \  -d '{    "amount": 0.1,    "source": "string"  }'
{  "bank_value": 0.1,  "granted": 0.1,  "resource_id": "string",  "value": 0.1}
POST/api/v1/chrono/resources/{resource_id}/refill/purchase
POST
/api/v1/chrono/resources/{resource_id}/refill/purchase

Authorization

bearer_token
AuthorizationBearer <token>

In: header

Path Parameters

resource_id*string

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Purchase a paid refill/boost offer; settles through Treasury.

Response Body

application/json

curl -X POST "https://example.com/api/v1/chrono/resources/string/refill/purchase" \  -H "Content-Type: application/json" \  -d '{    "offer_id": "string",    "treasury_txn": "string"  }'
{  "bank_value": 0.1,  "cap_extension": 0.1,  "offer_id": "string",  "resource_id": "string",  "treasury_txn": "string",  "value": 0.1}
POST/api/v1/chrono/resources/{resource_id}/spend
POST
/api/v1/chrono/resources/{resource_id}/spend

Authorization

bearer_token
AuthorizationBearer <token>

In: header

Path Parameters

resource_id*string

Query Parameters

tz_offset_minutes?integer

Caller's UTC offset in minutes for timezone-anchored resets. Falls back to the definition's fallback_offset_minutes when absent.

Formatint32

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Atomic check-and-debit against the caller's resource.

Response Body

application/json

curl -X POST "https://example.com/api/v1/chrono/resources/string/spend" \  -H "Content-Type: application/json" \  -d '{    "amount": 0.1  }'
{  "bank_value": 0.1,  "resource_id": "string",  "spent": 0.1,  "value": 0.1}
GET/api/v1/chrono/users/{user_id}/resources
GET
/api/v1/chrono/users/{user_id}/resources

Authorization

bearer_token
AuthorizationBearer <token>

In: header

Path Parameters

user_id*string

Response Body

application/json

curl -X GET "https://example.com/api/v1/chrono/users/string/resources"
{  "states": [    {      "bank_value": 0.1,      "cap_extension": 0.1,      "converted_total": 0.1,      "created_at": "2019-08-24T14:15:22Z",      "definition_version": 0,      "id": "string",      "last_reset_at": 0,      "last_timestamp": 0,      "last_value": 0.1,      "modifiers": [        {          "expires_at": 0,          "factor": 0.1,          "id": "string",          "kind": "regen_multiplier",          "source": "string"        }      ],      "resource_id": "string",      "updated_at": "2019-08-24T14:15:22Z",      "user_id": "string"    }  ],  "user_id": "string"}

On this page