curl --request POST \
--url https://hub.oxen.ai/api/repos/{namespace}/{repo_name}/versions/uploads \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"hash": "<string>",
"size": 1,
"destination": {
"path": "<string>",
"workspace_id": "<string>"
}
}
'import requests
url = "https://hub.oxen.ai/api/repos/{namespace}/{repo_name}/versions/uploads"
payload = {
"hash": "<string>",
"size": 1,
"destination": {
"path": "<string>",
"workspace_id": "<string>"
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
hash: '<string>',
size: 1,
destination: {path: '<string>', workspace_id: '<string>'}
})
};
fetch('https://hub.oxen.ai/api/repos/{namespace}/{repo_name}/versions/uploads', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://hub.oxen.ai/api/repos/{namespace}/{repo_name}/versions/uploads",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'hash' => '<string>',
'size' => 1,
'destination' => [
'path' => '<string>',
'workspace_id' => '<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://hub.oxen.ai/api/repos/{namespace}/{repo_name}/versions/uploads"
payload := strings.NewReader("{\n \"hash\": \"<string>\",\n \"size\": 1,\n \"destination\": {\n \"path\": \"<string>\",\n \"workspace_id\": \"<string>\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://hub.oxen.ai/api/repos/{namespace}/{repo_name}/versions/uploads")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"hash\": \"<string>\",\n \"size\": 1,\n \"destination\": {\n \"path\": \"<string>\",\n \"workspace_id\": \"<string>\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://hub.oxen.ai/api/repos/{namespace}/{repo_name}/versions/uploads")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"hash\": \"<string>\",\n \"size\": 1,\n \"destination\": {\n \"path\": \"<string>\",\n \"workspace_id\": \"<string>\"\n }\n}"
response = http.request(request)
puts response.read_body{
"status": "<string>",
"status_message": "<string>",
"file": "awaiting_parts",
"num_parts": 1,
"part_size": 1,
"part_window": 1,
"upload_id": "<string>",
"oxen_version": "<string>"
}Begin a version file upload
Begin uploading a large file in parts. A file may be at most 1 TiB, a provisional limit. The response’s file is awaiting_parts, with the upload id, the size of every part but the last, the number of parts, and how many parts the upload accepts at once, starting at the first part not yet hashed. When the request gives a destination, a workspace and a path, the file is staged there once its last part arrives. When the store already has the file, file is already_stored: no parts are needed, and the file is staged at the destination, if one was given. A client whose upload completed without a response, or failed to stage, begins it again.
curl --request POST \
--url https://hub.oxen.ai/api/repos/{namespace}/{repo_name}/versions/uploads \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"hash": "<string>",
"size": 1,
"destination": {
"path": "<string>",
"workspace_id": "<string>"
}
}
'import requests
url = "https://hub.oxen.ai/api/repos/{namespace}/{repo_name}/versions/uploads"
payload = {
"hash": "<string>",
"size": 1,
"destination": {
"path": "<string>",
"workspace_id": "<string>"
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
hash: '<string>',
size: 1,
destination: {path: '<string>', workspace_id: '<string>'}
})
};
fetch('https://hub.oxen.ai/api/repos/{namespace}/{repo_name}/versions/uploads', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://hub.oxen.ai/api/repos/{namespace}/{repo_name}/versions/uploads",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'hash' => '<string>',
'size' => 1,
'destination' => [
'path' => '<string>',
'workspace_id' => '<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://hub.oxen.ai/api/repos/{namespace}/{repo_name}/versions/uploads"
payload := strings.NewReader("{\n \"hash\": \"<string>\",\n \"size\": 1,\n \"destination\": {\n \"path\": \"<string>\",\n \"workspace_id\": \"<string>\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://hub.oxen.ai/api/repos/{namespace}/{repo_name}/versions/uploads")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"hash\": \"<string>\",\n \"size\": 1,\n \"destination\": {\n \"path\": \"<string>\",\n \"workspace_id\": \"<string>\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://hub.oxen.ai/api/repos/{namespace}/{repo_name}/versions/uploads")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"hash\": \"<string>\",\n \"size\": 1,\n \"destination\": {\n \"path\": \"<string>\",\n \"workspace_id\": \"<string>\"\n }\n}"
response = http.request(request)
puts response.read_body{
"status": "<string>",
"status_message": "<string>",
"file": "awaiting_parts",
"num_parts": 1,
"part_size": 1,
"part_window": 1,
"upload_id": "<string>",
"oxen_version": "<string>"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
The namespace of the repository
The name of the repository
Body
Response
Upload begun, or the file already stored
- Option 1
- Option 2
The answer to POST /versions/uploads.
awaiting_parts x >= 0x >= 0How many consecutive parts the upload accepts at once, starting at the first part not yet hashed. A part past them gets 429, so a client sending parts in order keeps at most this many in flight.
x >= 0