Microsoft Azure Items API

Operations for managing items (documents)

GitHub OpenAPI

Operations 5

Each operation below carries the questions people ask an LLM about it and the instructions they give an agent to run it. Generated by API Evangelist overlay

GET /dbs/{databaseId}/colls/{containerId}/docs List documents in a Cosmos DB container · Microsoft Azure List Items #
Ask an LLM
“What documents are stored in one of my Cosmos DB containers?”
“Can I page through items with a continuation token and a max item count?”
Tell an agent
List items in container {containerId} of database {databaseId}.
Show up to {x-ms-max-item-count} documents from {containerId} in {databaseId}.
POST /dbs/{databaseId}/colls/{containerId}/docs Create or upsert a document in a container · Microsoft Azure Create an Item #
Ask an LLM
“How do I insert a new JSON document into a Cosmos DB container?”
“Can I upsert an item so it's replaced if the id already exists?”
Tell an agent
Create item {id} in container {containerId} of database {databaseId}.
Upsert document {id} into {containerId} ({databaseId}) with partition key {x-ms-documentdb-partitionkey}.
GET /dbs/{databaseId}/colls/{containerId}/docs/{itemId} Read a document by id and partition key · Microsoft Azure Get an Item #
Ask an LLM
“How do I read a single Cosmos DB document if I know its id and partition key?”
“Can I fetch one item without running a query?”
Tell an agent
Get item {itemId} from container {containerId} in database {databaseId}.
Read document {itemId} with partition key {x-ms-documentdb-partitionkey} from {containerId}.
PUT /dbs/{databaseId}/colls/{containerId}/docs/{itemId} Replace an existing document entirely · Microsoft Azure Replace an Item #
Ask an LLM
“Can I overwrite a whole existing document with a new version?”
“What replaces an item that already exists in a container?”
Tell an agent
Replace item {itemId} in container {containerId} of database {databaseId}.
Overwrite existing document {itemId} (partition {x-ms-documentdb-partitionkey}) in {containerId}.
DELETE /dbs/{databaseId}/colls/{containerId}/docs/{itemId} Delete a document from a container · Microsoft Azure Delete an Item #
Ask an LLM
“How do I remove one document from a Cosmos DB container?”
“Do I need the partition key to delete an item?”
Tell an agent destructive · confirm first
Delete item {itemId} from container {containerId} in database {databaseId}.
Remove document {itemId} in partition {x-ms-documentdb-partitionkey} of {containerId}.

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/microsoft-azure:microsoft-azure-items-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

microsoft-azure-items-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Microsoft Azure Azure Cosmos DB REST Items API
  description: Azure Cosmos DB is a globally distributed, multi-model database service that provides turnkey global distribution, elastic scaling of throughput and storage, single-digit millisecond latency at the 99th percentile, and guaranteed high availability, all backed by industry-leading SLAs. The REST API enables programmatic access to Cosmos DB resources for creating, querying, and managing databases, containers, items, stored procedures, triggers, and user-defined functions.
  version: '2018-12-31'
  contact:
    name: Microsoft Azure Support
    url: https://azure.microsoft.com/en-us/support/
    email: azuresupport@microsoft.com
  license:
    name: Microsoft API License
    url: https://learn.microsoft.com/en-us/legal/
  x-logo:
    url: https://azure.microsoft.com/svghandler/azure-logo.png
servers:
- url: https://{accountName}.documents.azure.com
  description: Azure Cosmos DB account endpoint
  variables:
    accountName:
      default: mycosmosaccount
      description: The name of the Azure Cosmos DB account.
security:
- masterKey: []
- resourceToken: []
tags:
- name: Items
  description: Operations for managing items (documents)
paths:
  /dbs/{databaseId}/colls/{containerId}/docs:
    get:
      operationId: Items_List
      summary: Microsoft Azure List Items
      description: Returns a list of items (documents) under the specified container.
      tags:
      - Items
      parameters:
      - $ref: '#/components/parameters/DatabaseIdParameter'
      - $ref: '#/components/parameters/ContainerIdParameter'
      - $ref: '#/components/parameters/ApiVersionParameter'
      - $ref: '#/components/parameters/MaxItemCountParameter'
      - $ref: '#/components/parameters/ContinuationParameter'
      - $ref: '#/components/parameters/PartitionKeyParameter'
      responses:
        '200':
          description: Successfully returned the list of items.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ItemListResult'
              examples:
                ItemsList200Example:
                  summary: Default Items_List 200 response
                  x-microcks-default: true
                  value:
                    _rid: '500123'
                    Documents:
                    - id: abc123
                      _rid: '500123'
                      _ts: 10
                      _self: example_value
                      _etag: example_value
                      _attachments: example_value
                    _count: 10
        default:
          description: Error response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                ItemsListdefaultExample:
                  summary: Default Items_List default response
                  x-microcks-default: true
                  value:
                    code: example_value
                    message: example_value
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
    post:
      operationId: Items_Create
      summary: Microsoft Azure Create an Item
      description: Creates a new item (document) in the specified container.
      tags:
      - Items
      parameters:
      - $ref: '#/components/parameters/DatabaseIdParameter'
      - $ref: '#/components/parameters/ContainerIdParameter'
      - $ref: '#/components/parameters/ApiVersionParameter'
      - $ref: '#/components/parameters/PartitionKeyParameter'
      - name: x-ms-documentdb-is-upsert
        in: header
        description: If true, the operation will perform an upsert instead of create.
        schema:
          type: boolean
          default: false
        example: true
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              description: The JSON document to create.
              properties:
                id:
                  type: string
                  description: The unique identifier of the item.
              required:
              - id
              additionalProperties: true
            examples:
              ItemsCreateRequestExample:
                summary: Default Items_Create request
                x-microcks-default: true
                value:
                  id: abc123
      responses:
        '201':
          description: Successfully created the item.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Item'
              examples:
                ItemsCreate201Example:
                  summary: Default Items_Create 201 response
                  x-microcks-default: true
                  value:
                    id: abc123
                    _rid: '500123'
                    _ts: 10
                    _self: example_value
                    _etag: example_value
                    _attachments: example_value
        '409':
          description: An item with the specified ID already exists.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                ItemsCreate409Example:
                  summary: Default Items_Create 409 response
                  x-microcks-default: true
                  value:
                    code: example_value
                    message: example_value
        default:
          description: Error response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                ItemsCreatedefaultExample:
                  summary: Default Items_Create default response
                  x-microcks-default: true
                  value:
                    code: example_value
                    message: example_value
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
  /dbs/{databaseId}/colls/{containerId}/docs/{itemId}:
    get:
      operationId: Items_Get
      summary: Microsoft Azure Get an Item
      description: Retrieves an item (document) by its ID and partition key.
      tags:
      - Items
      parameters:
      - $ref: '#/components/parameters/DatabaseIdParameter'
      - $ref: '#/components/parameters/ContainerIdParameter'
      - name: itemId
        in: path
        required: true
        description: The ID of the item.
        schema:
          type: string
        example: '500123'
      - $ref: '#/components/parameters/ApiVersionParameter'
      - $ref: '#/components/parameters/PartitionKeyParameter'
      responses:
        '200':
          description: Successfully returned the item.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Item'
              examples:
                ItemsGet200Example:
                  summary: Default Items_Get 200 response
                  x-microcks-default: true
                  value:
                    id: abc123
                    _rid: '500123'
                    _ts: 10
                    _self: example_value
                    _etag: example_value
                    _attachments: example_value
        '404':
          description: The item was not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                ItemsGet404Example:
                  summary: Default Items_Get 404 response
                  x-microcks-default: true
                  value:
                    code: example_value
                    message: example_value
        default:
          description: Error response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                ItemsGetdefaultExample:
                  summary: Default Items_Get default response
                  x-microcks-default: true
                  value:
                    code: example_value
                    message: example_value
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
    put:
      operationId: Items_Replace
      summary: Microsoft Azure Replace an Item
      description: Replaces the entire item (document).
      tags:
      - Items
      parameters:
      - $ref: '#/components/parameters/DatabaseIdParameter'
      - $ref: '#/components/parameters/ContainerIdParameter'
      - name: itemId
        in: path
        required: true
        description: The ID of the item.
        schema:
          type: string
        example: '500123'
      - $ref: '#/components/parameters/ApiVersionParameter'
      - $ref: '#/components/parameters/PartitionKeyParameter'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              description: The replacement JSON document.
              additionalProperties: true
            examples:
              ItemsReplaceRequestExample:
                summary: Default Items_Replace request
                x-microcks-default: true
                value: {}
      responses:
        '200':
          description: Successfully replaced the item.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Item'
              examples:
                ItemsReplace200Example:
                  summary: Default Items_Replace 200 response
                  x-microcks-default: true
                  value:
                    id: abc123
                    _rid: '500123'
                    _ts: 10
                    _self: example_value
                    _etag: example_value
                    _attachments: example_value
        default:
          description: Error response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                ItemsReplacedefaultExample:
                  summary: Default Items_Replace default response
                  x-microcks-default: true
                  value:
                    code: example_value
                    message: example_value
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
    delete:
      operationId: Items_Delete
      summary: Microsoft Azure Delete an Item
      description: Deletes an item (document) from the container.
      tags:
      - Items
      parameters:
      - $ref: '#/components/parameters/DatabaseIdParameter'
      - $ref: '#/components/parameters/ContainerIdParameter'
      - name: itemId
        in: path
        required: true
        description: The ID of the item.
        schema:
          type: string
        example: '500123'
      - $ref: '#/components/parameters/ApiVersionParameter'
      - $ref: '#/components/parameters/PartitionKeyParameter'
      responses:
        '204':
          description: Successfully deleted the item.
        default:
          description: Error response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                ItemsDeletedefaultExample:
                  summary: Default Items_Delete default response
                  x-microcks-default: true
                  value:
                    code: example_value
                    message: example_value
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
components:
  schemas:
    Item:
      type: object
      description: A Cosmos DB item (document).
      properties:
        id:
          type: string
          description: The unique identifier of the item.
          example: abc123
        _rid:
          type: string
          readOnly: true
          description: System-generated resource ID.
          example: '500123'
        _ts:
          type: integer
          readOnly: true
          description: System-generated timestamp.
          example: 10
        _self:
          type: string
          readOnly: true
          description: System-generated URI for the resource.
          example: example_value
        _etag:
          type: string
          readOnly: true
          description: System-generated resource etag.
          example: example_value
        _attachments:
          type: string
          readOnly: true
          description: Addressable path for the attachments resource.
          example: example_value
      additionalProperties: true
      required:
      - id
    ErrorResponse:
      type: object
      description: Error response from Cosmos DB.
      properties:
        code:
          type: string
          description: The error code.
          example: example_value
        message:
          type: string
          description: The error message.
          example: example_value
      required:
      - code
      - message
    ItemListResult:
      type: object
      description: List of Cosmos DB items.
      properties:
        _rid:
          type: string
          readOnly: true
          example: '500123'
        Documents:
          type: array
          items:
            $ref: '#/components/schemas/Item'
          description: List of items.
          example: []
        _count:
          type: integer
          readOnly: true
          example: 10
  parameters:
    PartitionKeyParameter:
      name: x-ms-documentdb-partitionkey
      in: header
      description: The partition key value for the requested item. Must be a JSON array with a single value, e.g., ["partitionKeyValue"].
      schema:
        type: string
    ContinuationParameter:
      name: x-ms-continuation
      in: header
      description: A continuation token returned from a previous request for pagination.
      schema:
        type: string
    MaxItemCountParameter:
      name: x-ms-max-item-count
      in: header
      description: The maximum number of items to return per page. Default is 100, maximum is 1000.
      schema:
        type: integer
        default: 100
        maximum: 1000
    ApiVersionParameter:
      name: x-ms-version
      in: header
      required: true
      description: The version of the Cosmos DB REST API.
      schema:
        type: string
        default: '2018-12-31'
    DatabaseIdParameter:
      name: databaseId
      in: path
      required: true
      description: The ID of the database.
      schema:
        type: string
    ContainerIdParameter:
      name: containerId
      in: path
      required: true
      description: The ID of the container (collection).
      schema:
        type: string
  securitySchemes:
    masterKey:
      type: apiKey
      name: Authorization
      in: header
      description: Cosmos DB master key authorization. The authorization token is a hash-based message authentication code (HMAC) constructed from the request using the master key.
    resourceToken:
      type: apiKey
      name: Authorization
      in: header
      description: Cosmos DB resource token for fine-grained access control to specific resources.