Skip to main content
POST
/
files
/
upload
Upload a file
curl --request POST \
  --url https://api.bitgpt.xyz/files/upload \
  --header 'Authorization: <api-key>' \
  --header 'Content-Type: multipart/form-data' \
  --form file='@example-file' \
  --form 'name=<string>'
{
  "status": 200,
  "data": {
    "id": "123"
  },
  "error": null,
  "log": null,
  "validator": null,
  "support_id": null,
  "message": "Resource created successfully",
  "env": "development",
  "id": "file_0198042e-6dde-7b9c-bc91-452a7e0c833b",
  "name": "uploaded-file.jpg",
  "url": "https://assets.bitgpt.xyz/org_uploads/org_0196b0e9-11d8-7f26-b1d2-bd47054e4827/image/0198042e-6dde-76e0-b817-3afb324e29ac.jpg",
  "size": 1060793,
  "mime_type": "image/jpeg",
  "type": "image",
  "is_duplicate": true
}

Authorizations

Authorization
string
header
required

Send your access token as header Authorization: Bearer {accessToken}

Authorization
string
header
required

Your API key that starts with sk_live or sk_test. You can create yours at go.bitgpt.xyz/api-keys.

Body

multipart/form-data

Request body for uploading a file

file
file
required

The file to upload

name
string

Optional custom name for the file

Maximum string length: 255

Response

File uploaded successfully

Response containing the uploaded file information

status
enum<integer>
required

Status code of the response

Available options:
200,
201,
202
data
object
required

File object containing file identifier and URL for accessing the file resource

Example:
{
"id": "file_0196b6e6-54e3-796d-9c6a-2862a5fef597",
"url": "https://assets.bitgpt.xyz//app/public/src/storage/uploads/image/2025/05/09/0196b6e6-54e3-7290-9d73-0074c623e368.jpg"
}
message
string | null
required

Message of the response, human readable

Example:

"Resource created successfully"

env
enum<string>
required

API environment

Available options:
development,
production
error
string | null

Error message of the response, human readable

Example:

"Invalid email address"

log

Useful informaiton, not always present, to debug the response

Examples:
{ "request_id": "req_1234567890" }

"Some pertinent log message"

validator
object

Validator response object, each key is the field name and value is the error message

Example:
{
"email": "Invalid email address",
"password": "Password is required"
}
support_id
string<uuid> | null

Support ID linked to the response, used to identify it when talking with our team

Example:

"support_uuidv7-something-else"