Browse API & SDK
API & SDK · Core API

Upload File

This API endpoint allows you to upload a file to your project documents by sending a POST request with the file and additional metadata.

POST/v1/accounts/{account_id}/projects/{project_id}/documents/upload-file
2 min read

Request

The request should include a file and additional metadata about the file:

  • document (file, required): The file to be uploaded.
  • fileName (string, required): The name of the file.
  • logicalPath (string, required): The path where the file should be stored within the project.
  • meta (object, optional): Additional metadata for the file. This can include custom attributes relevant to the file or the project.

Example request

curl -X POST https://api.botdojo.com/api/v1/accounts/:account_id/projects/:project_id/documents/upload-file \
  -F "document=@/path/to/your/file" \
  -F "fileName=example.pdf" \
  -F "logicalPath=/documents/somefolder/example.pdf" \
  -H "Content-Type: multipart/form-data" \
  -H "Authorization: YOUR_API_KEY"

Response

  • id (string): The unique identifier for the uploaded document.
  • fileName (string): The name of the file.
  • contentType (string): The MIME type of the file.
  • sizeBytes (number): The size of the file in bytes.
  • logicalPath (string): The path where the file is stored within the project.
  • version (string): The version identifier of the file.
  • created (string): The timestamp when the file was uploaded.

Example response

{
  "id": "file-id",
  "fileName": "example.pdf",
  "contentType": "application/pdf",
  "sizeBytes": 1024,
  "logicalPath": "/documents/somefolder/example.pdf",
  "version": "uuid-generated-version",
  "created": "2024-04-26T21:13:37.496Z"
}

Error responses

  • 400 Bad Request: The request is invalid or missing required parameters.
  • 401 Unauthorized: The provided API key is invalid or missing.
  • 403 Forbidden: The user does not have the necessary permissions to upload files.
  • 404 Not Found: The specified account or project does not exist.
  • 500 Internal Server Error: An unexpected error occurred during the file upload.