SimpleKPI Logo

SimpleKPI AI › API reference

KPI Categories / KPIs

The same KPI object as KPIs, reached through its category. Use these when you already know the category and want to list or create KPIs inside it without filtering the whole account.

A KPI created here takes the category from the URL, so category_id in the body is ignored.

Base URL https://api.simplekpi.com/v1

Endpoints

  1. List the KPIs in a categoryGET /v1/kpicategories/{category_id}/kpis
  2. Create a KPI in a categoryPOST /v1/kpicategories/{category_id}/kpis
  3. Get a KPI in a categoryGET /v1/kpicategories/{category_id}/kpis/{id}
  4. Update a KPI in a categoryPUT /v1/kpicategories/{category_id}/kpis/{id}
  5. Delete a KPI in a categoryDELETE /v1/kpicategories/{category_id}/kpis/{id}

KPI object

NameTypeRead OnlyMandatoryMax Len.Notes
idintegeryesno Assigned by SimpleKPI when the KPI is created.
category_idintegernono The category the KPI belongs to.
icon_idinteger (16 bit)nono The icon shown against the KPI. Although the contract does not mark it mandatory, the value is checked — omitting it sends 0, which is not a real icon, and the request fails with 400. Read the ids from KPI Icons.
unit_idintegernono How the KPI's values are formatted. Checked against your account for the same reason as icon_id, so send a real id from KPI Units rather than leaving it out.
frequency_idstringnoyes How often data is entered against the KPI. Case sensitive, and must be one of the ids returned by KPI Frequencies. D Daily, W Weekly, M Monthly, Q Quarterly, Y Yearly.
namestringnoyes100What the KPI is called.
descriptionstringnono150Nullable. Free text shown alongside the KPI.
target_defaultdecimalnono Nullable. The target applied to new entries when none is given.
value_directionstringnoyes Which way the KPI has to move to be doing well. Case sensitive. U Up is good, D Down is good, N Neither.
aggregate_functionstringnoyes How the KPI's values roll up across a period. Case sensitive. SUM Add the values together, AVG Average the values.
is_calculatedbooleanyesno True when the KPI is derived from other KPIs. Calculated KPIs are maintained in the app and their entries cannot be written through the API.
sort_orderinteger (16 bit)nono Position of the KPI within its category.
is_activebooleannono Inactive KPIs stay on the account but are hidden from day-to-day views.
created_atdatetimeyesno  
updated_atdatetimeyesno  

List the KPIs in a category

GET /v1/kpicategories/{category_id}/kpis

Requires kpis:read on the API key.

Parameters

NameTypeRequiredDefaultNotes
category_idintegeryes The category to list.
pageintegerno1Which page to return, counting from 1.
rowsintegerno500How many rows per page. Defaults to 500.

Using curl

curl https://api.simplekpi.com/v1/kpicategories/{category_id}/kpis \
  -H "Authorization: Bearer skpi_your_api_key"

Status codes

CodeMeaning
200OK
400Bad Request
401Unauthorized
403Forbidden
429Too Many Requests

 

Create a KPI in a category

POST /v1/kpicategories/{category_id}/kpis

The category comes from the URL, so category_id in the body is ignored.

Requires kpis:write on the API key.

Parameters

NameTypeRequiredDefaultNotes
category_idintegeryes The category to create the KPI in.

Using curl

curl https://api.simplekpi.com/v1/kpicategories/{category_id}/kpis \
  -X POST \
  -H "Authorization: Bearer skpi_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{"category_id":5478,"icon_id":1,"unit_id":123,"frequency_id":"W","name":"New Sales","description":"Closed-won deals per week","target_default":100,"value_direction":"U","aggregate_function":"SUM","sort_order":1,"is_active":true}'

Example request body

{
  "category_id": 5478,
  "icon_id": 1,
  "unit_id": 123,
  "frequency_id": "W",
  "name": "New Sales",
  "description": "Closed-won deals per week",
  "target_default": 100,
  "value_direction": "U",
  "aggregate_function": "SUM",
  "sort_order": 1,
  "is_active": true
}

Status codes

CodeMeaning
201Created
400Bad Request
401Unauthorized
403Forbidden
429Too Many Requests

 

Get a KPI in a category

GET /v1/kpicategories/{category_id}/kpis/{id}

Returns 404 if the KPI exists but sits in a different category.

Requires kpis:read on the API key.

Parameters

NameTypeRequiredDefaultNotes
category_idintegeryes The category the KPI is in.
idintegeryes The KPI to return.

Using curl

curl https://api.simplekpi.com/v1/kpicategories/{category_id}/kpis/{id} \
  -H "Authorization: Bearer skpi_your_api_key"

Status codes

CodeMeaning
200OK
401Unauthorized
403Forbidden
404Not Found
429Too Many Requests

 

Update a KPI in a category

PUT /v1/kpicategories/{category_id}/kpis/{id}

Requires kpis:write on the API key.

Parameters

NameTypeRequiredDefaultNotes
category_idintegeryes The category the KPI is in.
idintegeryes The KPI to replace.

Using curl

curl https://api.simplekpi.com/v1/kpicategories/{category_id}/kpis/{id} \
  -X PUT \
  -H "Authorization: Bearer skpi_your_api_key"

Status codes

CodeMeaning
200OK
400Bad Request
401Unauthorized
403Forbidden
404Not Found
429Too Many Requests

 

Delete a KPI in a category

DELETE /v1/kpicategories/{category_id}/kpis/{id}

Deletes the KPI and its entries.

Requires kpis:write on the API key.

Parameters

NameTypeRequiredDefaultNotes
category_idintegeryes The category the KPI is in.
idintegeryes The KPI to delete.

Using curl

curl https://api.simplekpi.com/v1/kpicategories/{category_id}/kpis/{id} \
  -X DELETE \
  -H "Authorization: Bearer skpi_your_api_key"

Status codes

CodeMeaning
204No Content
400Bad Request
401Unauthorized
403Forbidden
404Not Found
429Too Many Requests