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 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106
type InsertRecord = DataInputRecord; /** * Xata input record */ type DataInputRecord = { [key: string]: RecordID | string | boolean | number | string[] | number[] | DateTime | ObjectValue | InputFileArray | InputFile | null; }; /** * @maxLength 255 * @minLength 1 * @pattern [a-zA-Z0-9_-~:]+ */ type RecordID = string; /** * @format date-time */ type DateTime = string; /** * Object column value */ type ObjectValue = { [key: string]: string | boolean | number | string[] | number[] | DateTime | ObjectValue; }; /** * Array of file entries * * @maxItems 50 */ type InputFileArray = InputFileEntry[]; /** * Object representing a file */ type InputFile = { name: FileName; mediaType?: MediaType; /* * Base64 encoded content * * @maxLength 20971520 */ base64Content?: string; /* * Enable public access to the file */ enablePublicUrl?: boolean; /* * Time to live for signed URLs */ signedUrlTimeout?: number; }; /** * Object representing a file in an array */ type InputFileEntry = { id?: FileItemID; name?: FileName; mediaType?: MediaType; /* * Base64 encoded content * * @maxLength 20971520 */ base64Content?: string; /* * Enable public access to the file */ enablePublicUrl?: boolean; /* * Time to live for signed URLs */ signedUrlTimeout?: number; }; /** * File name * * @maxLength 1024 * @minLength 0 * @pattern [0-9a-zA-Z!\-_\.\*'\(\)]* */ type FileName = string; /** * Media type * * @maxLength 255 * @minLength 3 * @pattern ^\w+/[-+.\w]+$ */ type MediaType = string; /** * Unique file identifier * * @maxLength 255 * @minLength 1 * @pattern [a-zA-Z0-9_-~:]+ */ type FileItemID = 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 |