Pular para o conteúdo principal
POST
Core - Upload retrieval file
Guia relacionado: guia de Arquivos. Consulte o guia de Arquivos para um passo a passo com exemplos.

Autorizações

Authorization
string
header
obrigatório

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

Corpo

application/json
filename
string
obrigatório

Name to store for the uploaded file, including extension when available.

content
string<bytes>
obrigatório

Base64-encoded file contents.

purpose
enum<string>

Intended usage category for the uploaded file. Defaults to retrieval when omitted. Accepts either the alias (retrieval, knowledge_datasource, batch, code_interpreter) or the prefixed value. A JSON upload returns the prefixed form in the response, and a multipart upload returns the lowercase alias.

Opções disponíveis:
FILE_PURPOSE_RETRIEVAL,
FILE_PURPOSE_KNOWLEDGE_DATASOURCE,
FILE_PURPOSE_BATCH,
FILE_PURPOSE_CODE_INTERPRETER
content_type
string

MIME type of the uploaded content, for example application/pdf.

project_id
string

Project the file is created in. Optional: project-scoped API keys default to the key's bound project; workspace-scoped callers default to the workspace's default project.

Resposta

OK

file
object
obrigatório

Newly created file.