Skip to main content
POST
/
files
文件上传接口
curl --request POST \
  --url https://geekai.co/api/v1/files \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: multipart/form-data' \
  --form file='@example-file' \
  --form purpose=file-url \
  --form format=text
{
  "uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "name": "<string>",
  "status": "pending",
  "size": 123,
  "type": "<string>",
  "md5": "<string>",
  "content": "<string>"
}
GeekAI provides file upload and content extraction capabilities, supporting various file formats, including images, audio, video, and documents (PDF/Office/plain text). You can upload files to be recognized through the file upload interface, and then obtain the file content through the file content extraction interface. With this basic service, you can implement higher-level business scenarios such as AI file conversation/RAG.

cURL Request Example

curl --location --request POST 'https://geekai.dev/api/v1/files' \
--header 'Authorization: Bearer {YOUR_GEEKAI_API_KEY}' \
--form 'file=@"/E:/Documents/geekai/test.pdf"'

Authorizations

Authorization
string
header
required

API认证token

Body

multipart/form-data
file
file
required

上传的文件,目前支持PDF/DOCX/XLSX/PPTX/PNG/JPG/JPEG/CSV/TXT/MD/MP3/MP4等格式

purpose
enum<string>
default:file-url

上传目的,目前仅支持获取文件URL、文件内容提取

Available options:
file-url,
file-extract
format
string
default:text

返回文件内容格式,目前仅支持文本格式

Example:

"text"

Response

成功响应

uuid
string<uuid>
required

文件唯一ID,可通过该ID获取文件内容

name
string
required

文件名称

status
enum<string>
required

文件状态: pending(待处理)/reading(读取中)/failed(读取失败)/done(已读取)

Available options:
pending,
reading,
processing,
failed,
done
size
integer

文件大小

type
string

文件MIME类型

md5
string

文件MD5值

content
string

文件内容(只有status=done时,才会填充该字段)