Delete a Collection

The Delete Collection operation deletes an existing collection in a database.

Note

These API reference articles shows how to create resources using the Azure Cosmos DB data plane API. With the data plane API you can configure basic options such as indexing policy, partition keys much like you can with Cosmos DB SDKs. If you require complete feature support for all Azure Cosmos DB resources, we recommend using the Cosmos DB Resource Provider.

Request

Method Request URI Description
DELETE https://{databaseaccount}.documents.azure.com/dbs/{db-id}/colls/{coll-id} The {databaseaccount} is the name of the Azure Cosmos DB account created under your subscription. The {db-id} value is the user generated name/ID of the database, not the system generated ID (rid). The {coll-id} value is the name of the collection to be deleted.

Headers

Delete Collection requires the headers listed under Common Azure Cosmos DB REST request headers.

Body

None.

Response

Headers

See Common Azure Cosmos DB REST response headers for headers that are returned by all Azure Cosmos DB responses.

Status codes

The following table lists common status codes returned by this operation. For a full list of status codes, see HTTP Status Codes.

Code Description
204 No Content The delete operation was successful.
404 Not Found The collection to be deleted is no longer a resource, that is, the collection was deleted.

Body

None.

Example

DELETE https://querydemo.documents.azure.com/dbs/testdb/colls/testcoll HTTP/1.1  
x-ms.date: 04/20/2021
authorization: type%3dmaster%26ver%3d1.0%26sig%3dWmlMB62iSXF%2f0CUMyBD00AzOFH4LlcjzibmFC6zocxc%3d  
Cache-Control: no-cache  
User-Agent: Microsoft.Azure.Documents.Client/1.6.0.0 samples-net/3  
x-ms-version: 2015-12-16  
Accept: application/json  
Host: querydemo.documents.azure.com  
Cookie: x-ms-session-token#0=365; x-ms-session-token=365  
Content-Length: 0  
  
HTTP/1.1 204 No Content  
Cache-Control: no-store, no-cache  
Pragma: no-cache  
Content-Length: 0  
Content-Type: application/json  
Content-Location: https://querydemo.documents.azure.com/dbs/testdb/colls/testcoll  
Server: Microsoft-HTTPAPI/2.0  
Strict-Transport-Security: max-age=31536000  
x-ms-last-state-change-utc: Fri, 25 Mar 2016 22:54:09.213 GMT  
x-ms-resource-quota: collections=5000;  
x-ms-resource-usage: collections=28;  
collection-partition-index: 0  
collection-service-index: 0  
x-ms-schemaversion: 1.1  
x-ms-alt-content-path: dbs/testdb  
x-ms-quorum-acked-lsn: 7850  
x-ms-current-write-quorum: 3  
x-ms-current-replica-set-size: 4  
x-ms-request-charge: 4.95  
x-ms-serviceversion: version=1.6.52.5  
x-ms-activity-id: c341354d-7040-4d01-8531-ab66caf7a01c  
x-ms-session-token: M:7851  
Set-Cookie: x-ms-session-token#M=7851; Domain=querydemo.documents.azure.com; Path=/dbs/-6MXAA==/colls/-6MXAPvmWww=  
Set-Cookie: x-ms-session-token=7851; Domain=querydemo.documents.azure.com; Path=/dbs/-6MXAA==/colls/-6MXAPvmWww=  
x-ms-gatewayversion: version=1.6.52.5  
Date: Mon, 28 Mar 2016 20:56:35 GMT  
  

See Also