Requires authorization
Streams data into BigQuery one record at a time without needing to run a load job. For more information, see streaming data into BigQuery. Try it now.
Access control: For more information, see access control.
Request
HTTP request
POST https://www.googleapis.com/bigquery/v2/projects/projectId/datasets/datasetId/tables/tableId/insertAll
Parameters
| Parameter name | Value | Description |
|---|---|---|
| Path parameters | ||
datasetId |
string |
Dataset ID of the destination table. |
projectId |
string |
Project ID of the destination table. |
tableId |
string |
Table ID of the destination table. |
Authorization
This request requires authorization with at least one of the following scopes (read more about authentication and authorization).
| Scope |
|---|
https://www.googleapis.com/auth/bigquery |
https://www.googleapis.com/auth/cloud-platform |
https://www.googleapis.com/auth/bigquery.insertdata |
Request body
In the request body, supply data with the following structure:
{
"kind": "bigquery#tableDataInsertAllRequest",
"skipInvalidRows": boolean,
"ignoreUnknownValues": boolean,
"templateSuffix": string,
"rows": [
{
"insertId": string,
"json": {
(key): (value)
}
}
]
}
| Property name | Value | Description | Notes |
|---|---|---|---|
kind |
string |
The resource type of the response. | |
rows[] |
list |
The rows to insert. | |
rows[].insertId |
string |
[Optional] A unique ID for each row. BigQuery uses this property to detect duplicate insertion requests on a best-effort basis. For more information, see data consistency. | |
rows[].json |
nested object |
[Required] A JSON object that contains a row of data. The object's properties and values must match the destination table's schema. | |
rows[].json.(key) |
nested object |
||
skipInvalidRows |
boolean |
[Optional] Insert all valid rows of a request, even if invalid rows exist. The default value is false, which causes the entire request to fail if any invalid rows exist. | |
ignoreUnknownValues |
boolean |
[Optional] Accept rows that contain values that do not match the schema. The unknown values are ignored. Default is false, which treats unknown values as errors. | |
templateSuffix |
string |
[Experimental] If specified, treats the destination table as a base template, and inserts the rows into an instance table named "{destination}{templateSuffix}". BigQuery will manage creation of the instance table, using the schema of the base template table. See https://cloud.google.com/bigquery/streaming-data-into-bigquery#template-tables for considerations when working with templates tables. |
Response
If successful, this method returns a response body with the following structure:
{
"kind": "bigquery#tableDataInsertAllResponse",
"insertErrors": [
{
"index": unsigned integer,
"errors": [
{
"reason": string,
"location": string,
"debugInfo": string,
"message": string
}
]
}
]
}
| Property name | Value | Description | Notes |
|---|---|---|---|
kind |
string |
The resource type of the response. | |
insertErrors[] |
list |
An array of errors for rows that were not inserted. | |
insertErrors[].index |
unsigned integer |
The index of the row that error applies to. | |
insertErrors[].errors[] |
list |
Error information for the row indicated by the index property. | |
insertErrors[].errors[].reason |
string |
A short error code that summarizes the error. For help on debugging the specific reason value you receive, see troubleshooting errors. |
|
insertErrors[].errors[].location |
string |
Specifies where the error occurred, if present. | |
insertErrors[].errors[].debugInfo |
string |
Debugging information. This property is internal to Google and should not be used. | |
insertErrors[].errors[].message |
string |
A human-readable description of the error. |
Try it!
Use the APIs Explorer below to call this method on live data and see the response. Alternatively, try the standalone Explorer.