Upload a file
curl --request POST \
--url https://api.zerogpu.ai/v1/files \
--header 'Content-Type: multipart/form-data' \
--header 'x-api-key: <api-key>' \
--header 'x-project-id: <api-key>' \
--form purpose=batch \
--form file='@example-file'import requests
url = "https://api.zerogpu.ai/v1/files"
files = { "file": ("example-file", open("example-file", "rb")) }
payload = { "purpose": "batch" }
headers = {
"x-api-key": "<api-key>",
"x-project-id": "<api-key>"
}
response = requests.post(url, data=payload, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('purpose', 'batch');
form.append('file', '<string>');
const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'x-project-id': '<api-key>'}
};
options.body = form;
fetch('https://api.zerogpu.ai/v1/files', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));falsepackage main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.zerogpu.ai/v1/files"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"purpose\"\r\n\r\nbatch\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("x-project-id", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}require 'uri'
require 'net/http'
url = URI("https://api.zerogpu.ai/v1/files")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["x-project-id"] = '<api-key>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"purpose\"\r\n\r\nbatch\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"id": "file-0123456789abcdef012345",
"object": "file",
"bytes": 5000,
"created_at": 1736290000,
"filename": "input.jsonl",
"purpose": "batch",
"status": "processed",
"expires_at": 1738882000
}Batch API
Upload file
Interactive playground for POST /v1/files (multipart JSONL upload).
POST
/
v1
/
files
Upload a file
curl --request POST \
--url https://api.zerogpu.ai/v1/files \
--header 'Content-Type: multipart/form-data' \
--header 'x-api-key: <api-key>' \
--header 'x-project-id: <api-key>' \
--form purpose=batch \
--form file='@example-file'import requests
url = "https://api.zerogpu.ai/v1/files"
files = { "file": ("example-file", open("example-file", "rb")) }
payload = { "purpose": "batch" }
headers = {
"x-api-key": "<api-key>",
"x-project-id": "<api-key>"
}
response = requests.post(url, data=payload, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('purpose', 'batch');
form.append('file', '<string>');
const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'x-project-id': '<api-key>'}
};
options.body = form;
fetch('https://api.zerogpu.ai/v1/files', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));falsepackage main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.zerogpu.ai/v1/files"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"purpose\"\r\n\r\nbatch\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("x-project-id", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}require 'uri'
require 'net/http'
url = URI("https://api.zerogpu.ai/v1/files")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["x-project-id"] = '<api-key>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"purpose\"\r\n\r\nbatch\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"id": "file-0123456789abcdef012345",
"object": "file",
"bytes": 5000,
"created_at": 1736290000,
"filename": "input.jsonl",
"purpose": "batch",
"status": "processed",
"expires_at": 1738882000
}Upload batch input JSONL before creating a batch.
- Set
purposetobatch. - Attach a
.jsonlfile (max 100 MB). Each line must match the JSONL format. - Copy the returned
id(e.g.file-…) intoinput_file_idon the create-batch playground.
Body
multipart/form-data
Response
File uploaded
Prefixed with file-.
Available options:
file Uploads use batch; batch results use batch_output.
Available options:
batch, batch_output Available options:
uploaded, processed, error ZeroGPU extension. true on batch error output files only.

