Insert rows
POST /projects/:projectid/databases/:dbid/tables/:tblid/rows
Add rows, creating any missing columns.
Each row is an object keyed by column name. Columns that do not exist yet are created from the values you send, which is the same behaviour the dashboard relies on.
Authentication
- Project API key: The credential for everything external. Created in Project Settings, bound to one project, and limited to the scopes it was granted. Format:
proj.<keyId>.<secret>. - Required permission:
databases.writeon :dbid.
Path parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
projectid | string | Yes | - | The project id. |
dbid | string | Yes | - | The database id. |
tblid | string | Yes | - | The table name. |
Request body
Content type: application/json
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
rows | object[] | Yes | - | A non-empty array of row objects, keyed by column name. Every key must be lower snake case. |
Example
{
"rows": [
{
"customer": "ada",
"total": 42.5
}
]
}
Example request
curl -X POST \
-H "Authorization: proj.KEY_ID.SECRET" \
-H "Content-Type: application/json" \
-d '{"rows":[{"customer":"ada","total":42.5}]}' \
{{BASE_URL}}/projects/{{PROJECT_ID}}/databases/DATABASE_ID/tables/orders/rows
Responses
201
Inserted, with the id assigned to each row.
{
"rowIds": [
"r_91ba"
]
}
400
rows was empty, or a key is not a valid column identifier.
Notes
- Because missing columns are created, a typo in a key adds a column rather than failing. Create your columns up front if you would rather a typo be an error.