Skip to main content
POST
/
fetch
/
fetch_content
Fetch Content
curl --request POST \
  --url https://api.usecortex.ai/fetch/fetch_content \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "file_id": "CortexDoc1234",
  "file_type": "<file_type>",
  "tenant_id": "tenant_1234",
  "return_content": true,
  "sub_tenant_id": "sub_tenant_4567"
}'
{
  "file_id": "CortexDoc1234",
  "file_content": "<string>",
  "success": true,
  "message": "Content fetched successfully"
}
Hit the Try it button to try this API now in our playground. It’s the best way to check the full request and response in one place, customize your parameters, and generate ready-to-use code snippets.

Sample Request

curl --request POST \
  --url https://api.usecortex.ai/fetch/fetch_content \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "file_id": "CortexDoc1234",
  "file_type": "<file_type>",
  "tenant_id": "tenant_1234",
  "return_content": true,
  "sub_tenant_id": "sub_tenant_4567"
}'

Functionality

  • Extracts user credentials and organization details from the API key
  • Validates the file access permissions for the specified tenant
  • Creates secure access tokens for file retrieval
  • When return_content is true: Returns the actual file content directly
  • When return_content is false: Generates time-limited download URLs for the requested file
  • Returns downloadable URLs that can be used to access the file content

Error Responses

All endpoints return consistent error responses following the standard format. For detailed error information, see our Error Responses documentation.

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json
file_id
string
required
Example:

"CortexDoc1234"

file_type
string
required
Example:

"<file_type>"

tenant_id
string
required
Example:

"tenant_1234"

return_content
boolean | null
default:true
sub_tenant_id
string | null
default:""
Example:

"sub_tenant_4567"

Response

Successful Response

file_id
string
required

Unique identifier for the file being fetched

Example:

"CortexDoc1234"

file_content
string | null
default:""

Content of the fetched file

success
boolean
default:true

Indicates whether the fetch operation completed successfully

Example:

true

message
string
default:Content fetched successfully

Status message about the fetch operation

I