Skip to main content

INSERT

POST 

https://cloud.singlebaseapis.com/api

The INSERT statement is used to insert one or multiple documents into a collection.

INSERT statement syntax

//--- short form
INSERT [$data] IN [collection_name];

//--- long form
INSERT INTO [collection_name] VALUES [$data]

Query Example

// insert one document
{
"query": "INSERT $data IN articles",
"variables": {
"data": {
"title": "Doc 1",
...
}
}
}
// Insert multiple documents
{
"query": "INSERT INTO articles VALUES $data",
"variables": {
"data": [
{
"title": "Doc 1",
...
},
{
"title": "Doc 2",
...
},
{
"title": "Doc 3",
...
}
]
}
}

Request

Body

    query stringrequired

    The X-SQL Query string

    variables objectrequired

    The variables

Responses

Mutation response

Schema
    data object[]

    Array of documents mutated

curl -L -X POST 'https://cloud.singlebaseapis.com/api/' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'X-API-KEY: <API_KEY_VALUE>' \
-H 'Authorization: Bearer <TOKEN>' \
--data-raw '{
"query": "string",
"variables": {}
}'
Request Collapse all
Base URL
https://cloud.singlebaseapis.com/api
Auth
Body
{
  "query": "string",
  "variables": {}
}
ResponseClear

Click the Send API Request button above and see the response here!