Azure Cosmos DB Component

Manage databases, collections, and documents within Azure Cosmos DB.
Component key: azure-cosmos-db
Description
Azure Cosmos DB is a Microsoft database service designed for handling various applications.
Manage databases, collections, and documents within Azure Cosmos DB.
API Documentation
This component was built using the Azure Cosmos DB (SQL) REST API.
Connections
Master Key
To authenticate this component using your Cosmos DB Core (SQL) API master key:
- Navigate to Azure Portal.
- Find your Cosmos DB account.
- In the left menu, under Settings, select Keys.
- Copy the Primary Key or Secondary Key.
You will also need the Cosmos DB account name (subdomain). For example, if your endpoint is: https://your-cosmos-account.documents.azure.com:443/
Then your account name is: your-cosmos-account
Use these values to configure the component connection.
Input | Notes | Example |
---|---|---|
Endpoint string / Required cosmosEndpoint | Your Azure Cosmos DB account endpoint URL. | https://your-cosmos-account.documents.azure.com:443 |
Master Key password / Required masterKey | Your Azure Cosmos DB account master key. You can find this in the Azure Cosmos DB account settings. | YOUR_MASTER_KEY |
Data Sources
Select Collection
Select a collection from the list of collections in a database | key: selectCollection | type: picklist
Input | Notes | Example |
---|---|---|
Connection connection / Required connection | Azure Cosmos DB connection configured with endpoint URL and access key. | |
Database ID string / Required databaseId | The ID of the database. | myDatabase |
Select Database
Select a database from the list of databases | key: selectDatabase | type: picklist
Input | Notes |
---|---|
Connection connection / Required connection | Azure Cosmos DB connection configured with endpoint URL and access key. |
Select Document
Select a document from the list of documents in a collection | key: selectDocument | type: picklist
Input | Notes | Example |
---|---|---|
Collection ID string / Required collectionId | The ID of the collection. | myCollection |
Connection connection / Required connection | Azure Cosmos DB connection configured with endpoint URL and access key. | |
Database ID string / Required databaseId | The ID of the database. | myDatabase |
Actions
Create Collection
Create a new collection in a database | key: createCollection
Input | Notes | Example |
---|---|---|
Collection ID string / Required collectionId | The ID of the collection. | myCollection |
Connection connection / Required connection | Azure Cosmos DB connection configured with endpoint URL and access key. | |
Database ID string / Required databaseId | The ID of the database. | myDatabase |
Partition Key Path string partitionKey | The path used as the partition key when creating the collection, e.g., `/category`. | /partition1 |
Throughput (RU/s) string throughput | The provisioned throughput for the collection in Request Units per second. <strong>Note:</strong> Serverless collections do not support setting throughput. | 400 |
{
"data": {
"id": "customers",
"indexingPolicy": {
"indexingMode": "consistent",
"automatic": true,
"includedPaths": [
{
"path": "/*"
}
],
"excludedPaths": [
{
"path": "/\"_etag\"/?"
}
]
},
"partitionKey": {
"paths": [
"/partition1"
],
"kind": "Hash"
},
"conflictResolutionPolicy": {
"mode": "LastWriterWins",
"conflictResolutionPath": "/_ts",
"conflictResolutionProcedure": ""
},
"geospatialConfig": {
"type": "Geography"
},
"_rid": "kVEpANSIJac=",
"_ts": 1753820539,
"_self": "dbs/kVEpAA==/colls/kVEpANSIJac=/",
"_etag": "\"00000e0c-0000-4d00-0000-68892d7b0000\"",
"_docs": "docs/",
"_sprocs": "sprocs/",
"_triggers": "triggers/",
"_udfs": "udfs/",
"_conflicts": "conflicts/"
}
}
Create Database
Create a new database in Cosmos DB | key: createDatabase
Input | Notes | Example |
---|---|---|
Connection connection / Required connection | Azure Cosmos DB connection configured with endpoint URL and access key. | |
Database ID string / Required databaseId | The ID of the database. | myDatabase |
{
"data": {
"id": "cosmicworks",
"_rid": "kVEpAA==",
"_self": "dbs/kVEpAA==/",
"_etag": "\"0000a60a-0000-4d00-0000-6887daea0000\"",
"_colls": "colls/",
"_users": "users/",
"_ts": 1753733866
}
}
Create Document
Create a new document in a collection | key: createDocument
Input | Notes | Example |
---|---|---|
Collection ID string / Required collectionId | The ID of the collection. | myCollection |
Connection connection / Required connection | Azure Cosmos DB connection configured with endpoint URL and access key. | |
Database ID string / Required databaseId | The ID of the database. | myDatabase |
Document code / Required document | The document as JSON string. | |
Partition Key Value string partitionKey | The value of the partition key for the document (required for partitioned collections). | electronics |
{
"data": {
"id": "1",
"partition1": "value1",
"_rid": "kVEpAMF-HdkCAAAAAAAAAA==",
"_self": "dbs/kVEpAA==/colls/kVEpAMF-Hdk=/docs/kVEpAMF-HdkCAAAAAAAAAA==/",
"_etag": "\"d5003222-0000-4d00-0000-6889cb6c0000\"",
"_attachments": "attachments/",
"_ts": 1753860972
}
}
Delete Collection
Delete a collection from a database | key: deleteCollection
Input | Notes | Example |
---|---|---|
Collection ID string / Required collectionId | The ID of the collection. | myCollection |
Connection connection / Required connection | Azure Cosmos DB connection configured with endpoint URL and access key. | |
Database ID string / Required databaseId | The ID of the database. | myDatabase |
{
"data": {
"success": true,
"message": "Collection myCollection deleted successfully"
}
}
Delete Database
Delete a database from Cosmos DB | key: deleteDatabase
Input | Notes | Example |
---|---|---|
Connection connection / Required connection | Azure Cosmos DB connection configured with endpoint URL and access key. | |
Database ID string / Required databaseId | The ID of the database. | myDatabase |
{
"data": {
"success": true,
"message": "Database myDatabase deleted successfully"
}
}
Delete Document
Delete a document from a collection | key: deleteDocument
Input | Notes | Example |
---|---|---|
Collection ID string / Required collectionId | The ID of the collection. | myCollection |
Connection connection / Required connection | Azure Cosmos DB connection configured with endpoint URL and access key. | |
Database ID string / Required databaseId | The ID of the database. | myDatabase |
Document ID string / Required documentId | The ID of the document. | doc1 |
ETag string etag | The ETag value for optimistic concurrency control. | "00000000-0000-0000-0000-000000000000" |
Partition Key Value string partitionKey | The value of the partition key for the document (required for partitioned collections). | electronics |
{
"data": {
"success": true,
"message": "Document doc1 deleted successfully"
}
}
Get Collection
Get a specific collection by ID | key: getCollection
Input | Notes | Example |
---|---|---|
Collection ID string / Required collectionId | The ID of the collection. | myCollection |
Connection connection / Required connection | Azure Cosmos DB connection configured with endpoint URL and access key. | |
Database ID string / Required databaseId | The ID of the database. | myDatabase |
{
"data": {
"id": "products",
"indexingPolicy": {
"indexingMode": "consistent",
"automatic": true,
"includedPaths": [
{
"path": "/*"
}
],
"excludedPaths": [
{
"path": "/\"_etag\"/?"
}
],
"fullTextIndexes": []
},
"partitionKey": {
"paths": [
"/category"
],
"kind": "Hash"
},
"uniqueKeyPolicy": {
"uniqueKeys": []
},
"conflictResolutionPolicy": {
"mode": "LastWriterWins",
"conflictResolutionPath": "/_ts",
"conflictResolutionProcedure": ""
},
"geospatialConfig": {
"type": "Geography"
},
"_rid": "kVEpAK0lM0g=",
"_ts": 1753733880,
"_self": "dbs/kVEpAA==/colls/kVEpAK0lM0g=/",
"_etag": "\"0000a80a-0000-4d00-0000-6887daf80000\"",
"_docs": "docs/",
"_sprocs": "sprocs/",
"_triggers": "triggers/",
"_udfs": "udfs/",
"_conflicts": "conflicts/",
"computedProperties": []
}
}
Get Database
Get a specific database by ID | key: getDatabase
Input | Notes | Example |
---|---|---|
Connection connection / Required connection | Azure Cosmos DB connection configured with endpoint URL and access key. | |
Database ID string / Required databaseId | The ID of the database. | myDatabase |
{
"data": {
"id": "cosmicworks",
"_rid": "kVEpAA==",
"_self": "dbs/kVEpAA==/",
"_etag": "\"0000a60a-0000-4d00-0000-6887daea0000\"",
"_colls": "colls/",
"_users": "users/",
"_ts": 1753733866
}
}
Get Document
Get a specific document by ID | key: getDocument
Input | Notes | Example |
---|---|---|
Collection ID string / Required collectionId | The ID of the collection. | myCollection |
Connection connection / Required connection | Azure Cosmos DB connection configured with endpoint URL and access key. | |
Database ID string / Required databaseId | The ID of the database. | myDatabase |
Document ID string / Required documentId | The ID of the document. | doc1 |
Partition Key Value string partitionKey | The value of the partition key for the document (required for partitioned collections). | electronics |
{
"data": {
"id": "1",
"partition1": "value1",
"_rid": "kVEpAMF-HdkCAAAAAAAAAA==",
"_self": "dbs/kVEpAA==/colls/kVEpAMF-Hdk=/docs/kVEpAMF-HdkCAAAAAAAAAA==/",
"_etag": "\"d5003222-0000-4d00-0000-6889cb6c0000\"",
"_attachments": "attachments/",
"_ts": 1753860972
}
}
List Collections
List all collections in a database | key: listCollections
Input | Notes | Example |
---|---|---|
Connection connection / Required connection | Azure Cosmos DB connection configured with endpoint URL and access key. | |
Database ID string / Required databaseId | The ID of the database. | myDatabase |
{
"data": {
"_rid": "kVEpAA==",
"DocumentCollections": [
{
"id": "products",
"indexingPolicy": {
"indexingMode": "consistent",
"automatic": true,
"includedPaths": [
{
"path": "/*"
}
],
"excludedPaths": [
{
"path": "/\"_etag\"/?"
}
],
"fullTextIndexes": []
},
"partitionKey": {
"paths": [
"/category"
],
"kind": "Hash"
},
"uniqueKeyPolicy": {
"uniqueKeys": []
},
"conflictResolutionPolicy": {
"mode": "LastWriterWins",
"conflictResolutionPath": "/_ts",
"conflictResolutionProcedure": ""
},
"geospatialConfig": {
"type": "Geography"
},
"_rid": "kVEpAK0lM0g=",
"_ts": 1753733880,
"_self": "dbs/kVEpAA==/colls/kVEpAK0lM0g=/",
"_etag": "\"0000a80a-0000-4d00-0000-6887daf80000\"",
"_docs": "docs/",
"_sprocs": "sprocs/",
"_triggers": "triggers/",
"_udfs": "udfs/",
"_conflicts": "conflicts/",
"computedProperties": []
}
],
"_count": 1
}
}
List Databases
List all databases in the Cosmos DB account | key: listDatabases
Input | Notes |
---|---|
Connection connection / Required connection | Azure Cosmos DB connection configured with endpoint URL and access key. |
{
"data": {
"_rid": "",
"Databases": [
{
"id": "cosmicworks",
"_rid": "kVEpAA==",
"_self": "dbs/kVEpAA==/",
"_etag": "\"0000a60a-0000-4d00-0000-6887daea0000\"",
"_colls": "colls/",
"_users": "users/",
"_ts": 1753733866
}
],
"_count": 1
}
}
List Documents
List all documents in a collection | key: listDocuments
Input | Default | Notes | Example |
---|---|---|---|
Collection ID string / Required collectionId | The ID of the collection. | myCollection | |
Connection connection / Required connection | Azure Cosmos DB connection configured with endpoint URL and access key. | ||
Continuation Token string continuationToken | Token for pagination to get the next set of results. | {"token":"kVEpAK0lM0gBAAAAAAAAAA==","range":{"min":"","max":"FF"}} | |
Database ID string / Required databaseId | The ID of the database. | myDatabase | |
Fetch All boolean fetchAll | false | If enabled, retrieves all documents by automatically fetching every page of results. This overrides 'Max Item Count' and ignores any 'Continuation Token'. | |
Max Item Count string maxItemCount | Maximum number of items to return. | 100 |
{
"data": {
"_rid": "kVEpAK0lM0g=",
"Documents": [
{
"id": "1",
"partition1": "value1",
"_rid": "kVEpAMF-HdkCAAAAAAAAAA==",
"_self": "dbs/kVEpAA==/colls/kVEpAMF-Hdk=/docs/kVEpAMF-HdkCAAAAAAAAAA==/",
"_etag": "\"d5003222-0000-4d00-0000-6889cb6c0000\"",
"_attachments": "attachments/",
"_ts": 1753860972
}
],
"_count": 1,
"continuationToken": "{\"token\":\"kVEpAK0lM0gBAAAAAAAAAA==\",\"range\":{\"min\":\"\",\"max\":\"FF\"}}"
}
}
Update Document
Update an existing document in a collection | key: updateDocument
Input | Notes | Example |
---|---|---|
Collection ID string / Required collectionId | The ID of the collection. | myCollection |
Connection connection / Required connection | Azure Cosmos DB connection configured with endpoint URL and access key. | |
Database ID string / Required databaseId | The ID of the database. | myDatabase |
Document code / Required document | The document as JSON string. | |
Document ID string / Required documentId | The ID of the document. | doc1 |
ETag string etag | The ETag value for optimistic concurrency control. | "00000000-0000-0000-0000-000000000000" |
Partition Key Value string partitionKey | The value of the partition key for the document (required for partitioned collections). | electronics |
{
"data": {
"id": "1",
"name": "Sample Document",
"partition1": "value1",
"_rid": "kVEpAMF-HdkBAAAAAAAAAA==",
"_self": "dbs/kVEpAA==/colls/kVEpAMF-Hdk=/docs/kVEpAMF-HdkBAAAAAAAAAA==/",
"_etag": "\"d500f323-0000-4d00-0000-6889ce9d0000\"",
"_attachments": "attachments/",
"_ts": 1753861789
}
}
Changelog
2025-08-04
Initial release of the Azure Cosmos DB component with features for managing databases, collections, and documents.