NAV
curl

Introduction

Welcome to Gridly API document. You can use our API endpoints to access your data in Gridly.

Gridly API is organized around REST, accepts raw-data request bodies, returns standard HTTP response codes, authentication, and verbs.

We have language bindings in Curl, you can view code examples in the area to the right.

Authentication

CODE

curl --location --request GET 'https://api.gridly.com/v1/views/{VIEW_ID}/records' \
  --header 'Authorization: ApiKey {YOUR_API_KEY}'

Gridly API uses API key to authenticate requests. All API requests must be made over HTTPS and authenticated by having the API key included in the HTTP request header that looks like the following:

Authorization: ApiKey {YOUR_API_KEY}

To quickly get your API key, access your Gridly Dashboard, then select a Grid View and you can find the key in API quick start right panel.

Note: Owner and Administrators can go to Settings/API keys to create company-level API keys with scoped privileges and accesses.

Make sure to replace {YOUR_API_KEY} and {VIEW_ID} with yours.

Errors

Gridly API uses conventional HTTP response codes to indicate the success or failure of a request.

In general: Codes in the 2xx range indicate success. Codes in the 4xx range indicate user errors that failed given the information provided. Codes in the 5xx range indicate errors from Gridly’s servers.

An error response will return a JSON body that contains errors and message fields. Those will provide specific error conditions and human-readable message to identify what caused the error.

Success code

200 OK

Request executed successfully

User error codes

400 Bad Request

The request was unacceptable, often due to missing a required parameter or JSON request body fails to be parsed.

Bad Request response example:

{
  "errors": [
    {
      "code": "invalid",
      "field": "pageRequest",
      "message": "Unable to parse \"page\".",
      "resource": "database"
    }
  ],
  "message": "Unable to parse \"page\"."
}

401 Unauthorized

No valid API key provided.

402 Request Failed

The parameters were valid but the request failed.

403 Forbidden

The API key doesn’t have permissions to perform the request.

404 Not Found

The requested resource doesn’t exist

Not Found response example:

{
  "message" : "Validation failed.",
  "errors" : [ {
    "resource" : "view",
    "field" : "id",
    "code" : "missing",
    "message" : "View \"NezkWk3VEL\" could not be found."
  } ]
}

405 Method Not Allowed

The method received in the request is known by the origin server but not supported by the target resource.

409 Conflict

The request could not be completed due to a conflict with the current state of the target resource. This code is used in situations where the user might be able to resolve the conflict and resubmit the request.

422 Unprocessable Entity

This error shows up when validation fails on any field of request parameters or request body.

5xxx Server Errors

Something went wrong with Gridly server. The server encountered an unexpected condition that prevented it from fulfilling the request.

Project

List projects

CODE

curl --location --request GET 'https://api.gridly.com/v1/projects' \
--header 'Authorization: ApiKey {YOUR_API_KEY}'

OUTPUT

[
  {
    "id": 42,
    "name": "Foodie",
    "description": "I love food"
  }
]

To list projects of a company.

HTTP Request

GET /v1/projects

Response

Return a list of projects in an array if succeeded. Otherwise, return an error.

Retrieve a project

CODE

curl --location --request GET 'https://api.gridly.com/v1/projects/42' \
--header 'Authorization: ApiKey {YOUR_API_KEY}'

OUTPUT

{
  "id": 42,
  "name": "Foodie",
  "description": "I love food"
}

To retrieve a project.

HTTP Request

GET /v1/projects/<id>

ID can be found in the URL of the web application: app.gridly.com/projects/<id>.

Response

Return project data in object if succeeded. Otherwise, return an error.

Database

List databases

CODE

curl --location --request GET 'https://api.gridly.com/v1/databases?projectId=42' \
--header 'Authorization: ApiKey {YOUR_API_KEY}'

OUTPUT

[
  {
    "id": "me8y2x4v5v3djy",
    "name": "Cuisine"
  }
]

To list databases of a project.

HTTP Request

GET /v1/databases

Parameter

projectId optional

ID of the project. The ID can be found in the URL of the web application: app.gridly.com/projects/<id>.

Response

Return a list of databases in an array if succeeded. Otherwise, return an error.

Retrieve a database

CODE

curl --location --request GET 'https://api.gridly.com/v1/databases/me8y2x4v5v3djy' \
--header 'Authorization: ApiKey {YOUR_API_KEY}'

OUTPUT

{
  "id": "me8y2x4v5v3djy",
  "name": "Cuisine"
}

To retrieve a database.

HTTP Request

GET /v1/databases/<id>

Response

Return database data in an object if succeeded. Otherwise, return an error.

Grid

List grids

CODE

curl --location --request GET 'https://api.gridly.com/v1/grids?dbId=3xep36emk4j1dq' \
--header 'Authorization: ApiKey {YOUR_API_KEY}'

OUTPUT

[
  {
    "id": "v182ye104j8o33",
    "name": "Pizza"
  },
  {
    "id": "me6q2mvj4868l8",
    "name": "Burger"
  }
]

To list grids of a database.

GET /v1/grids

Parameters

dbId required

ID of the database you want to list of all the grids.

Response

Return a list of grids from a database if succeeded. Otherwise, return an error.

Retrieve a grid

CODE

curl --location --request GET 'https://api.gridly.com/v1/grids/em8vw50wzkl111' \
--header 'Authorization: ApiKey {YOUR_API_KEY}'

OUTPUT

{
  "id": "em8vw50wzkl111",
  "name": "Food",
  "columns": [
    {
      "id": "ingredient",
      "name": "Ingredient",
      "type": "multipleLines"
    },
    {
      "id": "price",
      "name": "Price",
      "type": "number"
    }
  ]
}

To retrieve a grid.

HTTP Request

GET /v1/grids/<id>

Response

Return grid data in an object if succeeded. Otherwise, return an error.

Update a grid

CODE

curl --location --request PATCH 'https://api.gridly.com/v1/grids/410nzk2op1zedp' \
--header 'Authorization: ApiKey {YOUR_API_KEY}' \
--header 'Content-type: application/json' \
--data-raw '{
   "name": "Fast Food",
   "metadata": {
           "type": "Burger",
           "cost": "42"
   }
}'

OUTPUT

{
  "id": "410nzk2op1zedp",
  "defaultAccessViewId": "me35v9mqd0e93y",
  "name": "Fast Food",
  "metadata": {
     "type": "Burger",
     "cost": "42"
   }
}

To update a grid from a database.

HTTP Request

PATCH /v1/grids/<id>

Request body

Parameters Type Description Required
name string New grid’s name that you want to update FALSE
metadata object Metadata object containing properties of the grid. Passing null into value will remove that key-value property. FALSE

Response

Return grid ‘s name and metadata in an object if succeeded. Otherwise, return an error.

View

List views

CODE

curl --location --request GET 
'https://api.gridly.com/v1/views?gridId=v1jqdkj24j1nkz' \
--header 'Authorization: ApiKey {YOUR_API_KEY}'

OUTPUT

[
  {
    "id": "41wk9m9q0w8mnn",
    "name": "Default View"
  },
  {
    "id": "emv2qozw1jn5vo",
    "name": "Default view"
  },
  {
    "id": "me2jk8me5225l8",
    "name": "Pizza"
  },
  {
    "id": "emv2qjxv3pjo11",
    "name": "Burger"
  }
]

To list views of a grid.

HTTP Request

GET /v1/views

Parameters

gridId required

ID of a grid.

Response

Return a list of view in an array if succeeded. Otherwise, return an error.

Retrieve a view

CODE

curl --location --request GET 'https://api.gridly.com/v1/views/v1v9jwwk1lwnkz' \
  --header 'Authorization: ApiKey {YOUR_API_KEY}'

OUTPUT

{
  "id": "v1v9jwwk1lwnkz",
  "name": "Food",
  "columns": [
    {
      "id": "ingredient",
      "name": "Ingredient",
      "type": "multipleLines"
    },
    {
      "id": "price",
      "name": "Price",
      "type": "number"
    }
  ]
}

To retrieve an existing view.

The API returns a view data in object, we can get all the columns of the view via columns field of this object.

HTTP Request

GET /v1/views/<id>

ID of the view. It can be found in the API quick start right panel of your Gridly Dashboard.

Response

Return view data in an object if succeeded. Otherwise, return an error.

Make sure to replace {YOUR_API_KEY} and {VIEW_ID} with yours.

Import

CODE

curl --location --request POST '<https://api.gridly.com/v1/views/v1v9jwwk1lwnkz/import'> \
  --header 'Authorization: ApiKey {YOUR_API_KEY}' \
--form 'file=@"/Users/tri/Desktop/fastlane.csv"' \
--form 'importRequest="{ 
 "firstDataRow": 1,
 "columnMappings":[{
   "columnId": "column1",
   "fileColumnIndex": 1
   }]
  }"'

To import a file (.csv) into a view.

Import API use multipart request

HTTP Request

POST /v1/views/<id>/import

Request body

Parameters Type Description Required
file .csv The spreadsheet file that contains data you want to import into Gridly. By default, columns will be mapped automatically between the file’s header names and the View’s column names. True
importRequest json JSON object to instruct how to read the file. Note: if you have the column with header’s name _recordId, Gridly will automatically map this with its Record ID column. False

importRequest

{ "withHeader": true, "columnMappings": [ { "columnId": "column1", "fileColumnIndex": 0 } ] }

Parameters Type Description
withHeader boolean Indicate the file has a header or not
columnMappings json To map between Gridly ‘s column ID and index of the column in the file. This mapping is mandatory when importing files without a header.

Response

Returns status 202 to indicate the server has accepted the file.

Export

CODE

curl --location --request GET '<https://api.gridly.com/v1/views/v1v9jwwk1lwnkz/export'> \
  --header 'Authorization: ApiKey {YOUR_API_KEY}'

To export data from a view into a file (.csv).

HTTP Request

GET /v1/views/<id>/export

Response

Return spreadsheet file (.csv) contains all columns and records of the View.

Record

Pagination

CODE

# Use `page={"offset": 5, "limit": 10}` to get 10 records from the sixth  
curl --location --request GET 'https://api.gridly.com/v1/views/v1v9jwwk1lwnkz/records?page=%7B%22offset%22%3A+5%2C+%22limit%22%3A+10%7D' \
  --header 'Authorization: ApiKey {YOUR_API_KEY}'

The list API method uses a page object in the query parameter for the bulk fetching. By default, maximun 100 resources will be returned on each request, if this page object isn’t specified in the request, the first page of resources from 1 to 100 will be returned.

To get the full list of resources that more than 100 items, compares the field X-Total-Count in the response header of the first request, then calculate page param for the next requests.

Value of page has the following format { "offset": <offset>, "limit": <limit> }. Note that this value object need to be URL encoded.

offset

A number to indicate the starting index of the resource that we need to get. It is zero by default.

limit

A limit on the number of resources to be returned. Its default value is 100 and the max is 1000.

Filtering

CODE

# `query={"a3cb4a5dadf2e43ca9bafc437391a0dce": {"contains": "pizza" } }`
curl --location --request GET 'https://api.gridly.com/v1/views/v1v9jwwk1lwnkz/records?query=%7B%22a3cb4a5dadf2e43ca9bafc437391a0dce%22%3A+%7B%22contains%22%3A+%22pizza%22+%7D+%7D' \
  --header 'Authorization: ApiKey {YOUR_API_KEY}'

To filter on a API response, use query object in the query params of the HTTP request.

Value of query has the following format { "<columnId>": { "<operator>": <value> } }. Note that this value object need to be URL encoded.

columnId

The ID of the column to be filtered.

operator

Is one of the following values:

Operator Meaning
“=” Equal
“!=” Not equal
“<” Less than
“<=” Less than or equal
“>” Greater than
“>=” Greater than or equal
“contains” Contains a string
“startsWith” Starts with a string
“endsWith” Ends with a string
“regex” Matches a Regular Expression
“notRegex” Does not match a Regular Expression
“in” Is one of the given values
“between” Between two given values
“isEmpty” Is empty
“isNotEmpty” Is not empty

You can pass many key-value pairs of filters like this:

{ "ingredient": { "contains": "cheese" }, "price": { "<": 42 } }

Sorting

CODE

# `sort={"a3cb4a5dadf2e43ca9bafc437391a0dce": "desc"}`
curl --location --request GET 'https://api.gridly.com/v1/views/v1v9jwwk1lwnkz/records?sort=%7B%22a3cb4a5dadf2e43ca9bafc437391a0dce%22%3A+%22desc%22%7D' \
  --header 'Authorization: ApiKey {YOUR_API_KEY}'

To sort the response list, use the sort object in the query params.

Value of sort has the following format { "<columnId>": "<sortDirection>" }. Note that this value object need to be URL encoded.

columnId

The ID of the column to be sorted.

sortDirection

The direction to sort by. The value can be:

Sort direction Meaning
“asc” Ascending
“desc” Descending

We can pass many key-value pairs like this:

{ "ingredient": "asc", "price": "desc" }

List records

CODE

curl --location --request GET 'https://api.gridly.com/v1/views/v1v9jwwk1lwnkz/records?columnIds=a3cb4a5dadf2e43ca9bafc437391a0dce,a3cb4a5dadf2e43ca9bafc437391a0dce' \
  --header 'Authorization: ApiKey {YOUR_API_KEY}'

OUTPUT

[
  {
    "id": "me6q2mvj4868l8",
    "cells": [
      {
        "columnId": "v182ye104j8o33",
        "value": "spaghetti"
      },
      {
        "columnId": "em8vw50wzkl111",
        "dependencyStatus": "upToDate",
        "value": 99
      }
    ],
    "path": "Path Level 1"
  },
  {
    "id": "41wk9m9q0w8mnn",
    "cells": [
      {
        "columnId": "emv2qozw1jn5vo",
        "value": "pizza"
      }
      {
        "columnId": "emv2qjxv3pjo11",
        "dependencyStatus": "outOfDate"
        "value": 60
      }
    ],
    "path": "Path Level 1/Path Level 2"
  }
]

To list records in a view.

The API returns one page of records at a time. Each page will contain a limit number of records, which is 100 by default. Use pagination to get next pages, use filtering or sorting to format the results.

HTTP Request

GET /v1/views/<viewId>/records?columnIds=<columnID_1>,<columnID_2>&page=<page>&query=<query>&sort=<sort>

Parameters

viewId required

ID of the view. It can be found in the API quick start right panel of your Gridly Dashboard.

columnIds optional

Specify data of what columns of view to include in response

page optional

Starting index and number of records. More details pagination here

query optional

Criteria to filter records. More details filtering

sort optional

Order of records. More details sorting here

Response

Returns a list of records in ARRAY if the get succeeded, otherwise, returns an error object if something goes wrong.

Make sure to replace {YOUR_API_KEY} and {VIEW_ID} with yours.

Add records

CODE

curl --location --request POST 'https://api.gridly.com/v1/views/v1v9jwwk1lwnkz/records' \
--header 'Content-Type: application/json' \
--header 'Authorization: ApiKey {YOUR_API_KEY}' \
--data-raw '[
  {
    "path": "Path Level 1",
    "cells": [
      {
        "columnId": "{COLUMN_ID}",
        "value": "Pasta"
      }
    ]
  }
]'

OUTPUT

[
  {
    "id": "me6q2mvj4868l8",
    "cells": [
      {
        "columnId": "main_course",
        "value": "Pasta"
      }
    ],
    "path": "Path Level 1"
  }
]

To add new records to a view.

HTTP Request

POST /v1/views/<viewId>/records

Parameters

viewId required

ID of the view. It can be found in the API quick start right panel of your Gridly Dashboard.

Request body

A request body has the format of a list and in raw-data. Every object in the list represents a single record resource and has the following format:

{ "path": <value>, "cells": [ { "columnId": <value>, "value": <value> }, { "columnId": <value>, "value": <value> } ] }

Parameters Type Description
cells List List of cells within a record
cells[].columnId String ID of a column in a view. If a column isn’t specified in the list, an empty value will be added by default.
cells[].value Various Value of a cell. “various” means any type depending on the column’s type, for example: string, number, dateTime, etc.
path String This parameter is optional. This parameter specify path (folder) of this record. Use character / to indicate folder level (e.g Path Level 1/Path Level 2)

Make sure to replace {YOUR_API_KEY}, {VIEW_ID} and {COLUMN_ID} with yours.

Response

Returns a list of added records in ARRAY if the adding succeeded, returns an error object if something goes wrong.

Update records

CODE

curl --location --request PATCH 'https://api.gridly.com/v1/views/{VIEW_ID}/records' \
--header 'Content-Type: application/json' \
--header 'Authorization: ApiKey {YOUR_API_KEY}' \
--data-raw '[
  {
    "id": "{RECORD_ID}",
    "path": "Path Level 1"
    "cells": [
      {
        "columnId": "{COLUMN_ID}",
        "value": "Pasta"
      }
    ]
  }
]'

OUTPUT

[
  {
    "id": "v182ye104j8o33",
    "cells": [
      {
        "columnId": "main_course",
        "value": "Pasta"
      }
    ],
    "path": "Path Level 1"
  }
]

To update existing records of a view.

HTTP Request

PATCH /v1/views/<viewId>/records

Parameters

viewId required

ID of the view. It can be found in the API quick start right panel of your Gridly Dashboard.

Request body

A request body has the format of a list and in raw-data. Every object in the list represents a single record resource and has the following format:

{ "id": string, "path": <value>, "cells": [ { "columnId": <value>, "value": <value> } ] }

Parameters Type Description
id String ID of record to be updated
cells List List of cells within a record
cells[].columnId String ID of the column to be updated. If a column isn’t specified in the list, it will be left as they were.
cells[].value Various Value of a cell. “various” means any type depending on the column’s type, for example: string, number, dateTime, etc.
path String This parameter is optional. This parameter specify path (folder) of this record. Use character / to indicate folder level (e.g Path Level 1/Path Level 2)

Make sure to replace {YOUR_API_KEY}, {VIEW_ID}, {RECORD_ID} and {COLUMN_ID} with yours.

Response

Returns a list of updated records in ARRAY if the updating succeeded, return an error object if something goes wrong.

Delete records

CODE

curl --location --request DELETE 'https://api.gridly.com/v1/views/{VIEW_ID}/records' \
--header 'Content-Type: application/json' \
--header 'Authorization: ApiKey {YOUR_API_KEY}' \
--data-raw '{
  "ids": [
    "{RECORD_ID_1}",
    "{RECORD_ID_2}"
  ]
}'

To delete existing records of a view.

HTTP Request

DELETE /v1/views/<viewId>/records

Parameters

viewId required

ID of the view. It can be found in the API quick start right panel of your Gridly Dashboard.

Request body

Parameters Type Description Required
ids List List of record IDs need to be deleted True

Make sure to replace {YOUR_API_KEY}, {VIEW_ID} and {RECORD_ID} with yours.

Response

If successful, this method returns an empty response body.

Upload file

CODE

curl --location --request POST 'https://api.gridly.com/v1/views/{VIEW_ID}/records/{RECORD_ID}/files' \
--header 'Authorization: ApiKey {YOUR_API_KEY}' \
--form 'file=@"/Users/john/Photos/pizza.jpg"' \
--form 'columnId="{COLUMN_ID}"'

OUTPUT

{
  "id": "v182ye104j8o33.jpg",
  "originalName": "pizza.jpg",
  "contentType": "image/jpeg",
  "size": 150516
}

To upload file to the cell of a view.

HTTP Request

POST /v1/views/<viewId>/files

Parameters

viewId required

ID of the view. It can be found in the API quick start right panel of your Gridly Dashboard.

Multipart parameters

file required

Absolute file path of local machine.

recordId required

Id of the record.

columnId required

Id of the column.

Make sure to replace {YOUR_API_KEY}, {VIEW_ID} and {RECORD_ID} and ‘{COLUMN_ID}’ with yours.

Response

If successful, this method returns details of file structure in json format.

Download file

CODE

curl --location --request GET 'https://api.gridly.com/v1/views/{VIEW_ID}/files/541617d3413147b0b365c87aae2b5a47.jpg' \
--header 'Authorization: ApiKey {YOUR_API_KEY}'

To download a file from the cell of a view.

HTTP Request

GET /v1/views/<viewId>/files/<id>

Parameters

viewId required

ID of the view. It can be found in the API quick start right panel of your Gridly Dashboard.

id required

FileId which was returned by upload file API

Make sure to replace {YOUR_API_KEY}, {VIEW_ID} and {RECORD_ID} with yours.

Response

If successful, this method returns the binary content of the file.