Upload a file
POST
/v1/files
const url = 'https://api.learningaide.ai/v1/files';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"purpose":"question_paper","filename":"example","content_type":"application/pdf","size_bytes":1}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.learningaide.ai/v1/files \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "purpose": "question_paper", "filename": "example", "content_type": "application/pdf", "size_bytes": 1 }'Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Header Parameters
Section titled “Header Parameters”Idempotency-Key
string
A unique value, such as a v4 UUID, that you reuse only to retry this request.
Request Bodyrequired
Section titled “Request Bodyrequired”Media typeapplication/json
object
purpose
required
string
filename
required
string
content_type
required
string
size_bytes
required
integer
Responses
Section titled “Responses”A new object was created. Its processing may continue in the background.
Media typeapplication/json
object
id
required
string
object
required
string
livemode
required
boolean
purpose
required
string
filename
required
string
content_type
required
string
size_bytes
required
integer
status
required
string
upload
required
created_at
required
string format: date-time
Example
{ "object": "file", "purpose": "question_paper", "content_type": "application/pdf", "status": "awaiting_upload", "upload": { "method": "PUT" }}Headers
Section titled “Headers”X-Request-Id
required
string
This request’s ID. Quote it when you contact support.
RateLimit-Limit
integer
Requests allowed per window.
RateLimit-Remaining
integer
Requests left in the current window.
RateLimit-Reset
integer
Seconds until the window resets.
Idempotent-Replayed
string
On the saved response to an earlier request with this Idempotency-Key.
default
Section titled “default”An error (client docs, “Errors”).
Media typeapplication/json
Headers
Section titled “Headers”X-Request-Id
required
string
This request’s ID. Quote it when you contact support.
RateLimit-Limit
integer
Requests allowed per window.
RateLimit-Remaining
integer
Requests left in the current window.
RateLimit-Reset
integer
Seconds until the window resets.
Retry-After
integer
Seconds to wait before asking again.