Get Upload URL

POST /uploads/signed-url

Use this endpoint to get an AWS S3 signed upload url to upload your file to, store the returned key to use after file is uploaded successfully.

Javascript example of how to upload file to the URL you receive from this endpoint:

try {
  // Get the S3 URL to upload file to.
  const authToken = '<Your Cody AI API Key>'
  const response = await fetch('', {
    method: 'POST',
    headers: {
      'Authorization': `Bearer ${authToken}`,
      'Content-Type': 'application/json'
    body: JSON.stringify({
      content_type: 'text/plain',
      file_name: 'knowledge.txt'

  const { key, url } = (await response.json()).data

  // Upload the File object to S3
  await fetch(url, {
    method: 'PUT',
    headers: {
      'Content-Type': 'text/plain',
    body: file, // File object from Web API

  // File is uploaded, now you can use the `key` you got from this endpoint.
} catch {
  // Handle file upload failure.


  • Original file name you want to upload, must contain the file extension.

  • MIME content type of the file.


  • 200 application/json


    Hide response attributes Show response attributes object
    • url string(uri)

      AWS S3 signed upload URL, you can make a put request to upload the file.

    • key string

      Key you can use for endpoints that require file uploads.

POST /uploads/signed-url
curl \
 -X POST \
 -H "Authorization: Bearer $ACCESS_TOKEN" \
 -H "Content-Type: application/json" \
 -d '{"file_name":"banana_shake.pdf","content_type":"application/pdf"}'
Request example
  "file_name": "banana_shake.pdf",
  "content_type": "application/pdf"
Response examples (200)
  "url": "",
  "key": "string"