Goatlab API Docs

Get a file from a space

GET
/v1/spaces/{spaceId}/files/{fileId}

This endpoint allows you to retrieve the content of a file from a space by its ID. You must provide the space ID, file ID in the path and the user ID, tenant 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.

Access Control:

Access to retrieve files from a space depends on your permissions and the space's visibility:

  • Private Spaces: Only accessible by the space owner
  • Public Spaces: Accessible by all users within the same tenant

Authorization

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

API Key with role based permission

In: header

Scope: PRODUCT, GEN_AI

Path Parameters

spaceId*string

The unique identifier of the space containing the file

fileId*string

The unique identifier 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

x-tenant-id*string

The ID of the tenant

Response Body

text/plain; charset=utf-8

application/json

application/json

application/json

application/json

application/json

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