Grist API Reference#
REST API for manipulating documents, workspaces, and team sites.
- API Usage is an introduction to using the API.
- API Console allows you to make API calls from the browser.
Grist API (1.0.1)
An API for manipulating Grist sites, workspaces, and documents.
List the orgs you have access to
This enumerates all the team sites or personal areas available.
Authorizations:
Responses
Response samples
- 200
[- {
- "id": 42,
- "name": "Grist Labs",
- "domain": "gristlabs",
- "owner": {
- "id": 101,
- "name": "Helga Hufflepuff",
- "picture": null
}, - "access": "owners",
- "createdAt": "2019-09-13T15:42:35.000Z",
- "updatedAt": "2019-09-13T15:42:35.000Z"
}
]
Describe an org
Authorizations:
path Parameters
required | integer or string This can be an integer id, or a string subdomain (e.g. |
Responses
Response samples
- 200
{- "id": 42,
- "name": "Grist Labs",
- "domain": "gristlabs",
- "owner": {
- "id": 101,
- "name": "Helga Hufflepuff",
- "picture": null
}, - "access": "owners",
- "createdAt": "2019-09-13T15:42:35.000Z",
- "updatedAt": "2019-09-13T15:42:35.000Z"
}
Modify an org
Authorizations:
path Parameters
required | integer or string This can be an integer id, or a string subdomain (e.g. |
Request Body schema: application/json
the changes to make
name | string |
Responses
Request samples
- Payload
{- "name": "ACME Unlimited"
}
List users with access to org
Authorizations:
path Parameters
required | integer or string This can be an integer id, or a string subdomain (e.g. |
Responses
Response samples
- 200
{- "users": [
- {
- "id": 1,
- "name": "Andrea",
- "email": "andrea@getgrist.com",
- "access": "owners"
}
]
}
Change who has access to org
Authorizations:
path Parameters
required | integer or string This can be an integer id, or a string subdomain (e.g. |
Request Body schema: application/json
the changes to make
required | object (OrgAccessWrite) |
Responses
Request samples
- Payload
{- "delta": {
- "users": {
- "foo@getgrist.com": "owners",
- "bar@getgrist.com": null
}
}
}
List workspaces and documents within an org
Authorizations:
path Parameters
required | integer or string This can be an integer id, or a string subdomain (e.g. |
Responses
Response samples
- 200
[- {
- "id": 97,
- "name": "Secret Plans",
- "access": "owners",
- "docs": [
- {
- "id": 145,
- "name": "Project Lollipop",
- "access": "owners",
- "isPinned": true,
- "urlId": null
}
], - "orgDomain": "gristlabs"
}
]
Create an empty workspace
Authorizations:
path Parameters
required | integer or string This can be an integer id, or a string subdomain (e.g. |
Request Body schema: application/json
settings for the workspace
name | string |
Responses
Request samples
- Payload
{- "name": "Retreat Docs"
}
Response samples
- 200
155
Describe a workspace
Authorizations:
path Parameters
workspaceId required | integer An integer id |
Responses
Response samples
- 200
{- "id": 97,
- "name": "Secret Plans",
- "access": "owners",
- "docs": [
- {
- "id": 145,
- "name": "Project Lollipop",
- "access": "owners",
- "isPinned": true,
- "urlId": null
}
], - "org": {
- "id": 42,
- "name": "Grist Labs",
- "domain": "gristlabs",
- "owner": {
- "id": 101,
- "name": "Helga Hufflepuff",
- "picture": null
}, - "access": "owners",
- "createdAt": "2019-09-13T15:42:35.000Z",
- "updatedAt": "2019-09-13T15:42:35.000Z"
}
}
List users with access to workspace
Authorizations:
path Parameters
workspaceId required | integer An integer id |
Responses
Response samples
- 200
{- "maxInheritedRole": "owners",
- "users": [
- {
- "id": 1,
- "name": "Andrea",
- "email": "andrea@getgrist.com",
- "access": "owners",
- "parentAccess": "owners"
}
]
}
Change who has access to workspace
Authorizations:
path Parameters
workspaceId required | integer An integer id |
Request Body schema: application/json
the changes to make
required | object (WorkspaceAccessWrite) |
Responses
Request samples
- Payload
{- "delta": {
- "maxInheritedRole": "owners",
- "users": {
- "foo@getgrist.com": "owners",
- "bar@getgrist.com": null
}
}
}
Create an empty document
Authorizations:
path Parameters
workspaceId required | integer An integer id |
Request Body schema: application/json
settings for the document
name | string |
isPinned | boolean |
Responses
Request samples
- Payload
{- "name": "Competitive Analysis",
- "isPinned": false
}
Response samples
- 200
"8b97c8db-b4df-4b34-b72c-17459e70140a"
Describe a document
Authorizations:
path Parameters
docId required | string A string id (UUID) |
Responses
Response samples
- 200
{- "id": 145,
- "name": "Project Lollipop",
- "access": "owners",
- "isPinned": true,
- "urlId": null,
- "workspace": {
- "id": 97,
- "name": "Secret Plans",
- "access": "owners",
- "org": {
- "id": 42,
- "name": "Grist Labs",
- "domain": "gristlabs",
- "owner": {
- "id": 101,
- "name": "Helga Hufflepuff",
- "picture": null
}, - "access": "owners",
- "createdAt": "2019-09-13T15:42:35.000Z",
- "updatedAt": "2019-09-13T15:42:35.000Z"
}
}
}
Modify document metadata (but not its contents)
Authorizations:
path Parameters
docId required | string A string id (UUID) |
Request Body schema: application/json
the changes to make
name | string |
isPinned | boolean |
Responses
Request samples
- Payload
{- "name": "Competitive Analysis",
- "isPinned": false
}
List users with access to document
Authorizations:
path Parameters
docId required | string A string id (UUID) |
Responses
Response samples
- 200
{- "maxInheritedRole": "owners",
- "users": [
- {
- "id": 1,
- "name": "Andrea",
- "email": "andrea@getgrist.com",
- "access": "owners",
- "parentAccess": "owners"
}
]
}
Change who has access to document
Authorizations:
path Parameters
docId required | string A string id (UUID) |
Request Body schema: application/json
the changes to make
required | object (DocAccessWrite) |
Responses
Request samples
- Payload
{- "delta": {
- "maxInheritedRole": "owners",
- "users": {
- "foo@getgrist.com": "owners",
- "bar@getgrist.com": null
}
}
}
Content of document, as an Sqlite file
Authorizations:
path Parameters
docId required | string A string id (UUID) |
query Parameters
nohistory | boolean Remove document history (can significantly reduce file size) |
template | boolean Remove all data and history but keep the structure to use the document as a template |
Responses
Content of table, as a CSV file
Authorizations:
path Parameters
docId required | string A string id (UUID) |
query Parameters
tableId required | string Name of a table (normalized). |
header | string Enum: "colId" "label" Format for headers. Labels tend to be more human-friendly while colIds are more normalized. |
Responses
The schema of a table
The schema follows frictionlessdata's table-schema standard.
Authorizations:
path Parameters
docId required | string A string id (UUID) |
query Parameters
tableId required | string Name of a table (normalized). |
header | string Enum: "colId" "label" Format for headers. Labels tend to be more human-friendly while colIds are more normalized. |
Responses
Response samples
- 200
{- "name": "string",
- "title": "string",
- "format": "csv",
- "mediatype": "text/csv",
- "encoding": "utf-8",
- "dialect": "{\n \"dialect\": {\n \"delimiter\": \";\"\n }\n}\n",
- "schema": "{\n \"schema\": {\n \"fields\": [\n {\n \"name\": \"first_name\",\n \"type\": \"string\"\n \"constraints\": {\n \"required\": true\n }\n },\n {\n \"name\": \"age\",\n \"type\": \"integer\"\n },\n ],\n \"primaryKey\": [\n \"name\"\n ]\n }\n}\n"
}
Fetch records from a table
Authorizations:
path Parameters
docId required | string A string id (UUID) |
tableId required | string normalized table name (see |
query Parameters
filter | string Example: filter={"pet": ["cat", "dog"]} This is a JSON object mapping column names to arrays of allowed values. For example, to filter column |
sort | string Example: sort=pet,-age Order in which to return results. If a single column name is given (e.g. |
limit | number Example: limit=5 Return at most this number of rows. A value of 0 is equivalent to having no limit. |
hidden | boolean Set to true to include the hidden columns (like "manualSort") |
header Parameters
X-Sort | string Example: pet,-age Same as |
X-Limit | number Example: 5 Same as |
Responses
Response samples
- 200
{- "records": [
- {
- "id": 1,
- "fields": {
- "pet": "cat",
- "popularity": 67
}
}, - {
- "id": 2,
- "fields": {
- "pet": "dog",
- "popularity": 95
}
}
]
}
Add records to a table
Authorizations:
path Parameters
docId required | string A string id (UUID) |
tableId required | string normalized table name (see |
query Parameters
noparse | boolean Set to true to prohibit parsing strings according to the column type. |
Request Body schema: application/json
the records to add
required | Array of objects |
Responses
Request samples
- Payload
{- "records": [
- {
- "fields": {
- "pet": "cat",
- "popularity": 67
}
}, - {
- "fields": {
- "pet": "dog",
- "popularity": 95
}
}
]
}
Response samples
- 200
{- "records": [
- {
- "id": 1
}, - {
- "id": 2
}
]
}
Modify records of a table
Authorizations:
path Parameters
docId required | string A string id (UUID) |
tableId required | string normalized table name (see |
query Parameters
noparse | boolean Set to true to prohibit parsing strings according to the column type. |
Request Body schema: application/json
the records to change, with ids
required | Array of objects |
Responses
Request samples
- Payload
{- "records": [
- {
- "id": 1,
- "fields": {
- "pet": "cat",
- "popularity": 67
}
}, - {
- "id": 2,
- "fields": {
- "pet": "dog",
- "popularity": 95
}
}
]
}
Add or update records of a table
Authorizations:
path Parameters
docId required | string A string id (UUID) |
tableId required | string normalized table name (see |
query Parameters
noparse | boolean Set to true to prohibit parsing strings according to the column type. |
onmany | string Enum: "first" "none" "all" Which records to update if multiple records are found to match
|
noadd | boolean Set to true to prohibit adding records. |
noupdate | boolean Set to true to prohibit updating records. |
allow_empty_require | boolean Set to true to allow |
Request Body schema: application/json
The records to add or update. Instead of an id, a require
object is provided, with the same structure as fields
. If no query parameter options are set, then the operation is as follows. First, we check if a record exists matching the values specified for columns in require
. If so, we update it by setting the values specified for columns in fields
. If not, we create a new record with a combination of the values in require
and fields
, with fields
taking priority if the same column is specified in both. The query parameters allow for variations on this behavior.
required | Array of objects |
Responses
Request samples
- Payload
{- "records": [
- {
- "require": {
- "pet": "cat"
}, - "fields": {
- "popularity": 67
}
}, - {
- "require": {
- "pet": "dog"
}, - "fields": {
- "popularity": 95
}
}
]
}
Add tables to a document
Authorizations:
path Parameters
docId required | string A string id (UUID) |
Request Body schema: application/json
the tables to add
required | Array of objects |
Responses
Request samples
- Payload
{- "tables": [
- {
- "id": "People",
- "columns": [
- {
- "id": "pet",
- "fields": {
- "label": "Pet"
}
}, - {
- "id": "popularity",
- "fields": {
- "label": "Popularity ❤"
}
}
]
}
]
}
Response samples
- 200
{- "tables": [
- {
- "id": "People"
}, - {
- "id": "Places"
}
]
}
Modify tables of a document
Authorizations:
path Parameters
docId required | string A string id (UUID) |
Request Body schema: application/json
the tables to change, with ids
required | Array of objects |
Responses
Request samples
- Payload
{- "tables": [
- {
- "id": "People",
- "fields": {
- "tableRef": 1,
- "onDemand": true
}
}, - {
- "id": "Places",
- "fields": {
- "tableRef": 2,
- "onDemand": false
}
}
]
}
List columns in a table
Authorizations:
path Parameters
docId required | string A string id (UUID) |
tableId required | string normalized table name (see |
query Parameters
hidden | boolean Set to true to include the hidden columns (like "manualSort") |
Responses
Response samples
- 200
{- "columns": [
- {
- "id": "pet",
- "fields": {
- "label": "Pet"
}
}, - {
- "id": "popularity",
- "fields": {
- "label": "Popularity ❤",
- "type": "Int"
}
}
]
}
Add columns to a table
Authorizations:
path Parameters
docId required | string A string id (UUID) |
tableId required | string normalized table name (see |
Request Body schema: application/json
the columns to add
required | Array of objects |
Responses
Request samples
- Payload
{- "columns": [
- {
- "id": "pet",
- "fields": {
- "label": "Pet"
}
}, - {
- "id": "popularity",
- "fields": {
- "label": "Popularity ❤",
- "type": "Int"
}
}, - {
- "id": "Order",
- "fields": {
- "type": "Ref:Orders",
- "visibleCol": 2
}
}, - {
- "id": "Formula",
- "fields": {
- "type": "Int",
- "formula": "$A + $B",
- "isFormula": true
}
}, - {
- "id": "Status",
- "fields": {
- "type": "Choice",
- "widgetOptions": "{\"choices\":[\"New\",\"Old\"],\"choiceOptions\":{\"New\":{\"fillColor\":\"#FF0000\",\"textColor\":\"#FFFFFF\"}}}"
}
}
]
}
Response samples
- 200
{- "columns": [
- {
- "id": "pet"
}, - {
- "id": "popularity"
}
]
}
Modify columns of a table
Authorizations:
path Parameters
docId required | string A string id (UUID) |
tableId required | string normalized table name (see |
Request Body schema: application/json
the columns to change, with ids
required | Array of objects |
Responses
Request samples
- Payload
{- "columns": [
- {
- "id": "pet",
- "fields": {
- "label": "Pet"
}
}, - {
- "id": "popularity",
- "fields": {
- "label": "Popularity ❤",
- "type": "Int"
}
}
]
}
Add or update columns of a table
Authorizations:
path Parameters
docId required | string A string id (UUID) |
tableId required | string normalized table name (see |
query Parameters
noadd | boolean Set to true to prohibit adding columns. |
noupdate | boolean Set to true to prohibit updating columns. |
replaceall | boolean Set to true to remove existing columns (except the hidden ones) that are not specified in the request body. |
Request Body schema: application/json
The columns to add or update. We check whether the specified column ID exists: if so, the column is updated with the provided data, otherwise a new column is created. Also note that some query parameters alter this behavior.
required | Array of objects |
Responses
Request samples
- Payload
{- "columns": [
- {
- "id": "pet",
- "fields": {
- "label": "Pet"
}
}, - {
- "id": "popularity",
- "fields": {
- "label": "Popularity ❤",
- "type": "Int"
}
}
]
}
Delete a column of a table
Authorizations:
path Parameters
docId required | string A string id (UUID) |
tableId required | string normalized table name (see |
colId required | string The column id (without the starting |
Responses
Work with table data, using a (now deprecated) columnar format. We now recommend the records
endpoints.
Fetch data from a table Deprecated
Deprecated in favor of records
endpoints. We have no immediate plans to remove these endpoints, but consider records
a better starting point for new projects.
Authorizations:
path Parameters
docId required | string A string id (UUID) |
tableId required | string normalized table name (see |
query Parameters
filter | string Example: filter={"pet": ["cat", "dog"]} This is a JSON object mapping column names to arrays of allowed values. For example, to filter column |
sort | string Example: sort=pet,-age Order in which to return results. If a single column name is given (e.g. |
limit | number Example: limit=5 Return at most this number of rows. A value of 0 is equivalent to having no limit. |
header Parameters
X-Sort | string Example: pet,-age Same as |
X-Limit | number Example: 5 Same as |
Responses
Response samples
- 200
{- "id": [
- 1,
- 2
], - "pet": [
- "cat",
- "dog"
], - "popularity": [
- 67,
- 95
]
}
Add rows to a table Deprecated
Deprecated in favor of records
endpoints. We have no immediate plans to remove these endpoints, but consider records
a better starting point for new projects.
Authorizations:
path Parameters
docId required | string A string id (UUID) |
tableId required | string normalized table name (see |
query Parameters
noparse | boolean Set to true to prohibit parsing strings according to the column type. |
Request Body schema: application/json
the data to add
property name* additional property | Array of objects |
Responses
Request samples
- Payload
{- "pet": [
- "cat",
- "dog"
], - "popularity": [
- 67,
- 95
]
}
Response samples
- 200
[- 101,
- 102,
- 103
]
Modify rows of a table Deprecated
Deprecated in favor of records
endpoints. We have no immediate plans to remove these endpoints, but consider records
a better starting point for new projects.
Authorizations:
path Parameters
docId required | string A string id (UUID) |
tableId required | string normalized table name (see |
query Parameters
noparse | boolean Set to true to prohibit parsing strings according to the column type. |
Request Body schema: application/json
the data to change, with ids
id required | Array of integers |
property name* additional property | Array of objects |
Responses
Request samples
- Payload
{- "id": [
- 1,
- 2
], - "pet": [
- "cat",
- "dog"
], - "popularity": [
- 67,
- 95
]
}
Response samples
- 200
[- 101,
- 102,
- 103
]
Delete rows of a table
Authorizations:
path Parameters
docId required | string A string id (UUID) |
tableId required | string normalized table name (see |
Request Body schema: application/json
the IDs of rows to remove
Responses
Request samples
- Payload
[- 101,
- 102,
- 103
]
Documents may include attached files. Data records can refer to these using a column of type Attachments
.
List metadata of all attachments in a doc
Authorizations:
path Parameters
docId required | string A string id (UUID) |
query Parameters
filter | string Example: filter={"pet": ["cat", "dog"]} This is a JSON object mapping column names to arrays of allowed values. For example, to filter column |
sort | string Example: sort=pet,-age Order in which to return results. If a single column name is given (e.g. |
limit | number Example: limit=5 Return at most this number of rows. A value of 0 is equivalent to having no limit. |
header Parameters
X-Sort | string Example: pet,-age Same as |
X-Limit | number Example: 5 Same as |
Responses
Response samples
- 200
{- "records": [
- {
- "id": 1,
- "fields": {
- "fileName": "logo.png",
- "fileSize": 12345,
- "timeUploaded": "2020-02-13T12:17:19.000Z"
}
}
]
}
Get the metadata for an attachment
Authorizations:
path Parameters
docId required | string A string id (UUID) |
attachmentId required | number (AttachmentId) An integer ID |
Responses
Response samples
- 200
{- "fileName": "logo.png",
- "fileSize": 12345,
- "timeUploaded": "2020-02-13T12:17:19.000Z"
}
Webhooks associated with a document
Authorizations:
path Parameters
docId required | string A string id (UUID) |
Responses
Response samples
- 200
{- "webhooks": [
- {
- "id": "xxxxxxx-xxxx-xxxx-xxxxxxxxxxxxxxxx",
- "fields": {
- "name": "new-project-email",
- "memo": "Send an email when a project is added",
- "enabled": true,
- "eventTypes": [
- "add",
- "update"
], - "isReadyColumn": null,
- "tableId": "Projects",
- "unsubscribeKey": "string"
}, - "usage": {
- "numWaiting": 0,
- "status": "idle",
- "updatedTime": 1685637500424,
- "lastSuccessTime": 1685637500424,
- "lastFailureTime": 1685637500424,
- "lastErrorMessage": null,
- "lastHttpStatus": 200,
- "lastEventBatch": {
- "size": 1,
- "attempts": 1,
- "errorMessage": null,
- "httpStatus": 200,
- "status": "success"
}
}
}
]
}
Create new webhooks for a document
Authorizations:
path Parameters
docId required | string A string id (UUID) |
Request Body schema: application/json
an array of webhook settings
required | Array of objects |
Responses
Request samples
- Payload
{- "webhooks": [
- {
- "fields": {
- "name": "new-project-email",
- "memo": "Send an email when a project is added",
- "enabled": true,
- "eventTypes": [
- "add",
- "update"
], - "isReadyColumn": null,
- "tableId": "Projects"
}
}
]
}
Response samples
- 200
{- "webhooks": [
- {
- "id": "xxxxxxx-xxxx-xxxx-xxxxxxxxxxxxxxxx"
}
]
}
Modify a webhook
Authorizations:
path Parameters
docId required | string A string id (UUID) |
webhookId required | string |
Request Body schema: application/json
the changes to make
name | string or null |
memo | string or null |
url | string <uri> |
enabled | boolean |
eventTypes | Array of strings |
isReadyColumn | string or null |
tableId | string |
Responses
Request samples
- Payload
{- "name": "new-project-email",
- "memo": "Send an email when a project is added",
- "enabled": true,
- "eventTypes": [
- "add",
- "update"
], - "isReadyColumn": null,
- "tableId": "Projects"
}
Run an SQL query against a document
Authorizations:
path Parameters
docId required | string A string id (UUID) |
query Parameters
q | string The SQL query to run. This GET endpoint is a simplified version of the corresponding POST endpoint, without support for parameters or options. See the POST endpoint for details of what's allowed in the SQL query string. |
Responses
Response samples
- 200
{- "statement": "select * from Pets ...",
- "records": [
- {
- "fields": {
- "id": 1,
- "pet": "cat",
- "popularity": 67
}
}, - {
- "fields": {
- "id": 2,
- "pet": "dog",
- "popularity": 95
}
}
]
}
Run an SQL query against a document, with options or parameters
Authorizations:
path Parameters
docId required | string A string id (UUID) |
Request Body schema: application/json
Query options
sql required | string The SQL query to run. Must be a single SELECT statement, with no trailing semicolon. WITH clauses are permitted. All Grist documents are currently SQLite databases, and the SQL query is interpreted and run by SQLite, with various defensive measures. Statements that would modify the database are not supported. |
Array of numbers or strings Parameters for the query. | |
timeout | number Timeout after which operations on the document will be interrupted. Specified in milliseconds. Defaults to 1000 (1 second). This default is controlled by an optional environment variable read by the Grist app, GRIST_SQL_TIMEOUT_MSEC. The default cannot be exceeded, only reduced. |
Responses
Request samples
- Payload
{- "sql": "select * from Pets where popularity >= ?",
- "args": [
- 50
], - "timeout": 500
}
Response samples
- 200
{- "statement": "select * from Pets ...",
- "records": [
- {
- "fields": {
- "id": 1,
- "pet": "cat",
- "popularity": 67
}
}, - {
- "fields": {
- "id": 2,
- "pet": "dog",
- "popularity": 95
}
}
]
}
Delete a user from Grist
This action also deletes the user's personal organisation and all the workspaces and documents it contains. Currently, only the users themselves are allowed to delete their own accounts.
⚠️ This action cannot be undone, please be cautious when using this endpoint ⚠️
Authorizations:
path Parameters
userId required | integer A user id |
Request Body schema: application/json
name required | string The user's name to delete (for confirmation, to avoid deleting the wrong account). |
Responses
Request samples
- Payload
{- "name": "John Doe"
}