Skip to content

Templates

List Templates API

Retrieve a list of templates owned by the authenticated user. In addition to any templates the user has created, every user has a default template, which contains the default chart settings for a new stacked bar chart.

Endpoint

GET https://api.instacharts.io/v1/templates

Authorization

This endpoint requires OAuth 2.0 authentication. Include your access token in the Authorization header:

Authorization: Bearer your_access_token

Query Parameters

ParameterRequiredDescription
workspaceIdNoYour workspace’s ID. Without it, only the built-in default template is returned; your saved templates require this parameter.

Response

Success Response (200)

{
"templates": [
{
"templateId": "template_000",
"name": "",
"title": "",
"type": "stackedBar"
},
{
"id": "template_abc123",
"templateId": "template_abc123",
"name": "Monthly Sales Dashboard",
"title": "Jan 2025 Sales",
"type": "line"
},
{
"id": "template_xyz789",
"templateId": "template_xyz789",
"name": "Product Distribution Pie Chart",
"title": "Product Distribution",
"type": "pie"
}
]
}

Error Responses

Authentication Error (401)

{
"error": "unauthorized",
"message": "Invalid or expired access token",
"code": "INVALID_TOKEN"
}

Example Requests

Basic Request

Terminal window
curl -X GET "https://api.instacharts.io/v1/templates?workspaceId=your_workspace_id" \
-H "Authorization: Bearer your_access_token"

Template Object Properties

PropertyTypeDescription
templateIdstringUnique identifier for the template
idstringSame value as templateId. Not present on the built-in default template
titlestringChart title of the template
namestringName of the template
typestringChart type (“line”, “bar”, “pie”, “scatter”, etc.) Chart Types