# Fetch directory

> Tag 5: the server asks the client for a directory the client mounts by identity and the server does not hold; the client answers with one channel response per file or per piece of a file; the server verifies the whole against the identity before the deploy.

Canonical: https://provider.diverge.network/2.3.0/endpoints/containers-agents-run/server/fetch-directory/
Specification revision: 2.3.0

The server opens this channel, before it deploys, for each entry of
`identity_directory_mounts` whose identity it does not hold. Every
such channel is opened at once, one per identity.

- **The request.** The tag byte `5` followed by the identity as JSON.
  [Request](/2.3.0/endpoints/containers-agents-run/server/fetch-directory/request/) states its
  form.
- **The response.** One channel response per file, or per piece of a
  file, and the channel response finish.
  [Response](/2.3.0/endpoints/containers-agents-run/server/fetch-directory/response/) states the
  sequence.
- **Verification.** The server stores the directory under the
  identity only when the manifest of the files received, as the
  [volumes::stat response](/2.3.0/endpoints/volumes-stat/response/) defines
  it, has the hash of the identity and the files' total length is
  its size. A set that does not match, a stream that ends short, and
  a finish with no channel response are the run's error.
