Skip to main content
POST
/
fetch
/
fetch-source-content
Error
A valid request URL is required to generate request examples
{
  "source_id": "CortexDoc1234",
  "success": true,
  "content": "<string>",
  "content_base64": "<string>",
  "presigned_url": "<string>",
  "content_type": "<string>",
  "size_bytes": 123,
  "message": "File fetched successfully",
  "error": "<string>"
}
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.

Examples

curl -X 'POST' \
'https://api.usecortex.ai/fetch/fetch-source-content' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"tenant_id": "string",
"sub_tenant_id": "string",
"source_id": "string",
"mode": "content",
"expiry_seconds": 3600
}'

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

Request to fetch source file content.

tenant_id
string
required

Unique identifier for the tenant/organization

Example:

"tenant_1234"

source_id
string
required

Source ID of the file to fetch

Example:

"CortexDoc1234"

sub_tenant_id
string | null

Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.

Example:

"sub_tenant_4567"

mode
enum<string>
default:content

Fetch mode: 'content' returns file content, 'url' returns presigned URL, 'both' returns both

Available options:
content,
url,
both
expiry_seconds
integer
default:3600

Expiry time in seconds for presigned URL (60-604800, default: 3600)

Required range: 60 <= x <= 604800
Example:

1

Response

Successful Response

Response for file fetch request.

source_id
string
required

Source ID of the fetched file

Example:

"CortexDoc1234"

success
boolean
default:true

Whether the fetch was successful

Example:

true

content
string | null

File content as string (if mode includes 'content')

content_base64
string | null

File content as base64 encoded string (for binary files, if mode includes 'content')

presigned_url
string | null

Presigned URL to access the file (if mode includes 'url')

content_type
string | null

Content type of the file

size_bytes
integer | null

Size of the file in bytes

message
string
default:File fetched successfully

Response message

error
string | null

Error message if fetch failed