5.12. GET /db/_all_docs

MethodGET /db/_all_docs
Request None
Response JSON object containing document information, ordered by the document ID
Admin Privileges Requiredno
Query ArgumentsArgumentdescending
 Description Return the documents in descending by key order
 Optionalyes
 Typeboolean
 Defaultfalse
   
 Argumentendkey
 Description Stop returning records when the specified key is reached
 Optionalyes
 Typestring
   
 Argumentendkey_docid
 Description Stop returning records when the specified document ID is reached
 Optionalyes
 Typestring
   
 Argumentgroup
 Description Group the results using the reduce function to a group or single row
 Optionalyes
 Typeboolean
 Defaultfalse
   
 Argumentgroup_level
 Description Specify the group level to be used
 Optionalyes
 Typenumeric
   
 Argumentinclude_docs
 Description Include the full content of the documents in the return
 Optionalyes
 Typeboolean
 Defaultfalse
   
 Argumentinclusive_end
 Description Specifies whether the specified end key should be included in the result
 Optionalyes
 Typeboolean
 Defaulttrue
   
 Argumentkey
 Description Return only documents that match the specified key
 Optionalyes
 Typestring
   
 Argumentlimit
 Description Limit the number of the returned documents to the specified number
 Optionalyes
 Typenumeric
   
 Argumentreduce
 Description Use the reduction function
 Optionalyes
 Typeboolean
 Defaulttrue
   
 Argumentskip
 Description Skip this number of records before starting to return the results
 Optionalyes
 Typenumeric
 Default0
   
 Argumentstale
 Description Allow the results from a stale view to be used
 Optionalyes
 Typestring
 Default 
 Supported Values 
 okAllow stale views
   
 Argumentstartkey
 Description Return records starting with the specified key
 Optionalyes
 Typestring
   
 Argumentstartkey_docid
 Description Return records starting with the specified document ID
 Optionalyes
 Typestring
   
 Argumentupdate_seq
 Description Include the update sequence in the generated results
 Optionalyes
 Typeboolean
 Defaultfalse

Returns a JSON structure of all of the documents in a given database. The information is returned as a JSON structure containing meta information about the return structure, and the list documents and basic contents, consisting the ID, revision and key. The key is generated from the document ID.

Table 5.7.  All Database Documents

FieldDescription
offset Offset where the document list started
rows [array] Array of document object
total_rows Number of documents in the database/view
update_seq (optional) Current update sequence for the database

By default the information returned contains only the document ID and revision. For example, the request:

HTTP Request
GET http://couchdb:5984/recipes/_all_docs
Accept: application/json

Returns the following structure:

HTTP Response
{
   "total_rows" : 18386,
   "rows" : [
      {
         "value" : {
            "rev" : "1-bc0d5aed1e339b1cc1f29578f3220a45"
         },
         "id" : "Aberffrawcake",
         "key" : "Aberffrawcake"
      },
      {
         "value" : {
            "rev" : "3-68a20c89a5e70357c20148f8e82ca331"
         },
         "id" : "Adukiandorangecasserole-microwave",
         "key" : "Adukiandorangecasserole-microwave"
      },
      {
         "value" : {
            "rev" : "3-9b2851ed9b6f655cc4eb087808406c60"
         },
         "id" : "Aioli-garlicmayonnaise",
         "key" : "Aioli-garlicmayonnaise"
      },
      ...
         ],
   "offset" : 0
}

The information is returned in the form of a temporary view of all the database documents, with the returned key consisting of the ID of the document. The remainder of the interface is therefore identical to the View query arguments and their behavior.