Skip to main content
GET
https://davinci-app.com
/
api
/
v2
/
programmatic
/
projects
/
{projectId}
/
files
/
{fileId}
cURL
curl --request GET \
  --url https://davinci-app.com/api/v2/programmatic/projects/{projectId}/files/{fileId} \
  --header 'Authorization: Bearer <token>'
import os
from davinci_sdk import DavinciClient

with DavinciClient(api_key=os.environ["DAVINCI_API_KEY"]) as client:
    download = client.projects.download_file("project-id", "file-id", branch="main")
    with open("downloaded-file", "wb") as file:
        file.write(download.content)
    print(download.content_type, download.content_length)
import { writeFile } from 'node:fs/promises';
import { DavinciClient } from '@celedon/davinci-sdk';

const client = new DavinciClient({
  apiKey: process.env.DAVINCI_API_KEY!,
});

const download = await client.projects.downloadFile('project-id', 'file-id', {
  branch: 'main',
});
await writeFile('downloaded-file', download.buffer);
console.log(download.contentType, download.contentLength);
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

fetch('https://davinci-app.com/api/v2/programmatic/projects/{projectId}/files/{fileId}', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
"<string>"
{
  "success": true,
  "error": {
    "code": "<string>",
    "message": "<string>",
    "details": {}
  }
}
{
  "success": true,
  "error": {
    "code": "<string>",
    "message": "<string>",
    "details": {}
  }
}
{
  "success": true,
  "error": {
    "code": "<string>",
    "message": "<string>",
    "details": {}
  }
}
{
  "success": true,
  "error": {
    "code": "<string>",
    "message": "<string>",
    "details": {}
  }
}
{
  "success": true,
  "error": {
    "code": "<string>",
    "message": "<string>",
    "details": {}
  }
}
{
  "success": true,
  "error": {
    "code": "<string>",
    "message": "<string>",
    "details": {}
  }
}

Authorizations

Authorization
string
header
default:dav_ak_live_your_token
required

Personal access token. Programmatic reads require the projects:read scope.

Path Parameters

projectId
string
required

Project id. May be compound in the form {projectId}--{branchName}.

Minimum string length: 1
fileId
string
required

Reference object id or storage filename.

Minimum string length: 1

Query Parameters

branch
string
default:main

Response

Raw file bytes. This response is not a JSON envelope.

The response is of type file.