Table Data
https://{your-workspace-slug}.{region}.xata.sh/db/db_branch_name/tables/table_name/data
This endpoint enables mutating data into a given database table. To query data, please see the query endpoint. For a tutorial on using the Records API, see the Record API documentation.
Expected Parameters
Name | Description | In | Required | Schema |
---|---|---|---|---|
db_branch_name | The DBBranchName matches the pattern `{db_name}:{branch_name}`. | path | ✅ | string |
table_name | The Table name | path | ✅ | string |
columns | Column filters | query | - | array |
Insert Record
POSThttps://{your-workspace-slug}.{region}.xata.sh/db/db_branch_name/tables/table_name/data
Insert a new Record into the Table
Request Body Type Definition
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
type InsertRecord = Record<string, any>; /** * Xata Table Record Metadata */ type Record = RecordMeta & { [key: string]: any; }; /** * Xata Table Record Metadata */ type RecordMeta = { id: RecordID; xata: { /* * The record's version. Can be used for optimistic concurrency control. */ version: number; /* * The record's table name. APIs that return records from multiple tables will set this field accordingly. */ table?: string; /* * Highlights of the record. This is used by the search APIs to indicate which fields and parts of the fields have matched the search. */ highlight?: { [key: string]: string[] | { [key: string]: any; }; }; /* * The record's relevancy score. This is returned by the search APIs. */ score?: number; /* * Encoding/Decoding errors */ warnings?: string[]; }; }; /** * @pattern [a-zA-Z0-9_-~:]+ */ type RecordID = string;
Status Code | Description | Example Response/Type Definition |
---|---|---|
201 | Record ID and version |
|
400 | Bad Request |
|
401 | Authentication Error |
|
404 | Example response |
|
5XX | Unexpected Error |