Search in Dropbox API v2

// By Eric Feng • May 21, 2015

[EDIT June 4, 2015] This post has been updated to reflect the latest API v2 syntax. This year, Dropbox released Firefly, our instant, full text search for our Dropbox for Business users. We're excited to bring a full text search endpoint to developers as part of the Dropbox API v2 preview.

Try it out!

The search endpoint will accept query, path, start, max_results, and mode keys in a JSON object. The start parameter is for paging through search results. With the path parameter, you can limit results to only be within a certain folder. The mode parameter specifies the type of content to search and can be “filename”, “filename_and_content”, or “deleted_filename”.

The search endpoint returns both filename and full-text search results for Dropbox for Business users, while other users will receive filename search results only.

Remember that this is a preview version and should not be used in production. Endpoints will change as we gather feedback and continue to improve the preview of the API. Please let us know what you think in the comments or on our developer forum.

files/search (RPC-style)

Sample request: 

curl -X POST https://api.dropboxapi.com/2/files/search \
  --header "Authorization: Bearer " \
  --header "Content-Type: application/json" \
  --data "{\"path\":\"\", \"query\": \"bacon\"}"

Sample Response:

200 OK
Content-Type: application/json
{
  "matches": [
    {
      "match_type": { ".tag": "filename" },
      "metadata": {
        ".tag": "filename",
        "client_modified": "2015-04-08T03:07:23Z",
        "name": "bacon.pptx",
        "path_lower": "/bacon.pptx",
        "rev": "c26a18d8270b",
        "server_modified": "2015-04-08T03:07:53Z",
        "size": 1203
      }
    },
    ...
  ],
  "more": true,
  "start": 100
}

// Copy link