Goatlab API Docs

Get a file

GET
/v1/files/{file_id}

This endpoint allows you to retrieve the content of a file by its ID. You must provide the file ID in the path and the user ID in the headers.

This endpoint returns the content of the specified file in LLM format. Use offset and max_characters together to paginate through files larger than max_characters. Set max_characters to -1 to retrieve the full file content without truncation.

Authorization

ApiTokenAuth PRODUCT, GEN_AI
x-api-key<token>

API Key with role based permission

In: header

Scope: PRODUCT, GEN_AI

Path Parameters

file_id*string

The ID of the file to retrieve

Query Parameters

max_characters?integer

Maximum number of characters of the file content to return. Use -1 to retrieve the full file content.

offset?integer

Number of characters to skip from the start of the file content before applying max_characters, allowing pagination through large files

Header Parameters

x-user-id*string

The ID of the user requesting the file

Response Body

text/plain; charset=utf-8

application/json

application/json

application/json

application/json

application/json

curl -X GET "https://example.com/v1/files/497f6eca-6276-4993-bfeb-53cbbbba6f08" \  -H "x-user-id: string"
"This is the content of the file in LLM format."
{
  "message": "Invalid file ID format"
}
{
  "message": "Invalid API Key"
}
{
  "message": "File not found"
}
{
  "message": "File is still being processed"
}
{
  "message": "Internal Server Error"
}