- Get started
- Introduction
- Authentication
- Making requests
- Streaming
- Audio
- Batch
- Models
- Invites
- Chat
- Users
- Projects
- Project users
- Project service accounts
- Project API keys
- Audit logs
- Usage
- Project rate limits
- Completions
- Uploads
- Embeddings
- Files
- Moderations
- Assistants (v1)
- Threads (v1)
- Messages (v1)
- Runs (v1)
- Images
- Fine-tuning
Create assistant file (v1)
POST
https://api.openai.com/v1/assistants/asst_abc123/files
Request
Authorization
Provide your bearer token in the
Authorization
header when making requests to protected resources.Example:
Authorization: Bearer ********************
Header Params
Authorization
stringÂ
required
Example:
Bearer $OPENAI_API_KEY"
Content-Type
stringÂ
required
Example:
application/json
OpenAI-Beta
stringÂ
required
Example:
assistants=v1
Body Params application/json
file_id
stringÂ
required
purpose="assistants"
) that the assistant should use. Useful for tools like retrieval
and code_interpreter
that can access files.Example
{
"file_id": "file-abc123"
}
Request samples
Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
Request Request Example
Shell
JavaScript
Java
Swift
curl --location --request POST 'https://api.openai.com/v1/assistants/asst_abc123/files' \
--header 'Authorization: Bearer $OPENAI_API_KEY"' \
--header 'OpenAI-Beta: assistants=v1' \
--header 'Content-Type: application/json' \
--data-raw '{
"file_id": "file-abc123"
}'
Responses
🟢200Success
application/json
Body
id
stringÂ
required
object
stringÂ
required
created_at
integerÂ
required
assistant_id
stringÂ
required
Example
{
"id": "file-abc123",
"object": "assistant.file",
"created_at": 1699055364,
"assistant_id": "asst_abc123"
}
Modified at 2024-12-13 10:20:37