---
title: "Initiate document selection and download flow"
method: POST
path: "/select-documents"
tags: ["Download"]
---

# Initiate document selection and download flow

`POST /select-documents`

The client will call this endpoint to initiate the flow of selecting and downloading documents.

## Request body

- SelectDocuments
  - `callback` CallbackLink, required
    - `url` string, required — The server will web-browser-redirect to this URL once the user has completed selecting documents or entering documenet metadata on the CDE
    - `expires_in` integer, required — The expiry period for the URL, in seconds
  - `server_context` string, nullable — A CDE controlled identifier recording the user's context on the CDE. For example which project and folder the user was on. If the client provides the `server_context` in subsequent calls then the CDE will attemp to load the UI at the same place.
  - `supported_file_extensions` string[] — The client may optionally provide an array of accepted file extensions that should be opened during this flow. The CDE server UI should make an attempt to only show files matching these extensions to the user for the download selection or help the user in selecting the desired files. However, the server does not have to guarantee that only files matching the extensions will be selected. The extensions here must contain the dot separator.

## Response `200`

The CDE returns a URL for the client to open in a local browser. The user will then be presented with the CDE UI to select and download documents

- DocumentDiscoverySessionInitialization
  - `select_documents_url` string, required — A CDE UI URL for the client to open in a local browser. The user would search and select documents directly in the CDE
  - `expires_in` integer, required — `select_documents_url` expiry in seconds

## Changes

- **2022-08-11** `2d09dcd8ade2` — 1 info
  - api operation id `/select-documents` was added
- **2022-03-21** `504148fb6f8f` — 1 warning, 1 info
  - removed the request property `selection_context`
  - added the new optional request property `server_context`
- **2022-02-21** `b008d8c6327f` — 1 info
  - added the new optional request property `supported_file_extensions`
- **2022-02-16** `30259031e29d` — 1 info
  - api tag `Download` added
- **2022-02-14** `3eaa30d597fd` — 2 warning, 3 info
  - removed the request property `server_context`
  - removed the request property `supported_file_extensions`
  - api operation id `/select-documents` removed and replaced with ``
  - api tag `Download` removed
  - …1 more

[Change history](https://skmtc.dev/buildingsmart/apis/opencde-documents-api/changes/select-documents/post.md)

---

[API](https://skmtc.dev/buildingsmart/apis/opencde-documents-api.md) · [All operations](https://skmtc.dev/buildingsmart/apis/opencde-documents-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/buildingsmart/opencde-documents-api/revisions/b6d5b5ee5da6/schema)
