Files
Retrieve file
GET
/
api
/
files
/
{file_id}
/
import requests
file_id = "file-abc123"
url = f"https://api.keywordsai.co/api/files/{file_id}/"
headers = {
"Authorization": "Bearer YOUR_API_KEY"
}
response = requests.get(url, headers=headers)
print(response.json())
const fileId = 'file-abc123';
const url = `https://api.keywordsai.co/api/files/${fileId}/`;
const headers = {
'Authorization': 'Bearer YOUR_API_KEY'
};
const response = await fetch(url, {
method: 'GET',
headers: headers
});
const data = await response.json();
console.log(data);
curl https://api.keywordsai.co/api/files/file-abc123/ \
-H "Authorization: Bearer YOUR_API_KEY"
{
"id": "file-abc123",
"object": "file",
"bytes": 1024,
"created_at": 1677610602,
"filename": "batch_input.jsonl",
"purpose": "batch"
}
{
"error": {
"message": "No such file: file-abc123",
"type": "invalid_request_error"
}
}
{
"error": "Authentication credentials were not provided."
}
Get information about a specific file by its ID. Returns metadata including filename, size, creation time, and purpose.
Customer credentials required: This endpoint requires your own OpenAI API key configured in Keywords AI dashboard (Settings → Providers).
Path parameters
string
required
The unique identifier of the file to retrieve. Format:
file-xxxxxExample
Example
file-abc123
Response
Returns the file object with metadata.{
"id": "file-abc123",
"object": "file",
"bytes": 1024,
"created_at": 1677610602,
"filename": "batch_input.jsonl",
"purpose": "batch"
}
{
"error": {
"message": "No such file: file-abc123",
"type": "invalid_request_error"
}
}
{
"error": "Authentication credentials were not provided."
}
import requests
file_id = "file-abc123"
url = f"https://api.keywordsai.co/api/files/{file_id}/"
headers = {
"Authorization": "Bearer YOUR_API_KEY"
}
response = requests.get(url, headers=headers)
print(response.json())
const fileId = 'file-abc123';
const url = `https://api.keywordsai.co/api/files/${fileId}/`;
const headers = {
'Authorization': 'Bearer YOUR_API_KEY'
};
const response = await fetch(url, {
method: 'GET',
headers: headers
});
const data = await response.json();
console.log(data);
curl https://api.keywordsai.co/api/files/file-abc123/ \
-H "Authorization: Bearer YOUR_API_KEY"
Was this page helpful?
⌘I
import requests
file_id = "file-abc123"
url = f"https://api.keywordsai.co/api/files/{file_id}/"
headers = {
"Authorization": "Bearer YOUR_API_KEY"
}
response = requests.get(url, headers=headers)
print(response.json())
const fileId = 'file-abc123';
const url = `https://api.keywordsai.co/api/files/${fileId}/`;
const headers = {
'Authorization': 'Bearer YOUR_API_KEY'
};
const response = await fetch(url, {
method: 'GET',
headers: headers
});
const data = await response.json();
console.log(data);
curl https://api.keywordsai.co/api/files/file-abc123/ \
-H "Authorization: Bearer YOUR_API_KEY"
{
"id": "file-abc123",
"object": "file",
"bytes": 1024,
"created_at": 1677610602,
"filename": "batch_input.jsonl",
"purpose": "batch"
}
{
"error": {
"message": "No such file: file-abc123",
"type": "invalid_request_error"
}
}
{
"error": "Authentication credentials were not provided."
}