Create a private image upload
curl --request POST \
--url https://api.matrices.com/v1/agents/{agentId}/images \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"size": 1875000
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({size: 1875000})
};
fetch('https://api.matrices.com/v1/agents/{agentId}/images', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.matrices.com/v1/agents/{agentId}/images"
payload = { "size": 1875000 }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.matrices.com/v1/agents/{agentId}/images"
payload := strings.NewReader("{\n \"size\": 1875000\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))
}{
"image": {
"format": "jpeg",
"id": "<string>",
"size": 1875000
},
"upload": {
"expiresAt": "2023-11-07T05:31:56Z",
"headers": {
"content-type": "image/jpeg",
"if-none-match": "*"
},
"url": "<string>"
}
}{
"error": "<string>",
"message": "<string>",
"attemptsRemaining": 123,
"code": "<string>",
"retryAfterSeconds": 123
}{
"error": "<string>",
"message": "<string>",
"attemptsRemaining": 123,
"code": "<string>",
"retryAfterSeconds": 123
}{
"error": "<string>",
"message": "<string>",
"attemptsRemaining": 123,
"code": "<string>",
"retryAfterSeconds": 123
}{
"error": "<string>",
"message": "<string>",
"attemptsRemaining": 123,
"code": "<string>",
"retryAfterSeconds": 123
}{
"error": "<string>",
"message": "<string>",
"attemptsRemaining": 123,
"code": "<string>",
"retryAfterSeconds": 123
}Images
Create a private image upload
Creates a short-lived grant for one direct object-store PUT. The PUT body must contain exactly image.size bytes and send every returned header unchanged; browser File and Blob bodies derive the signed Content-Length automatically. The URL is a bearer and must not be logged, persisted, or shared. A grant succeeds once because the object is created with If-None-Match ”*”. Retry by creating a new upload, which may store duplicate bytes under another image ID. Upload success means private bytes were stored, not that a model decoded them; malformed or mislabeled bytes may be rejected by a later model request.
POST
/
v1
/
agents
/
{agentId}
/
images
Create a private image upload
curl --request POST \
--url https://api.matrices.com/v1/agents/{agentId}/images \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"size": 1875000
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({size: 1875000})
};
fetch('https://api.matrices.com/v1/agents/{agentId}/images', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.matrices.com/v1/agents/{agentId}/images"
payload = { "size": 1875000 }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.matrices.com/v1/agents/{agentId}/images"
payload := strings.NewReader("{\n \"size\": 1875000\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))
}{
"image": {
"format": "jpeg",
"id": "<string>",
"size": 1875000
},
"upload": {
"expiresAt": "2023-11-07T05:31:56Z",
"headers": {
"content-type": "image/jpeg",
"if-none-match": "*"
},
"url": "<string>"
}
}{
"error": "<string>",
"message": "<string>",
"attemptsRemaining": 123,
"code": "<string>",
"retryAfterSeconds": 123
}{
"error": "<string>",
"message": "<string>",
"attemptsRemaining": 123,
"code": "<string>",
"retryAfterSeconds": 123
}{
"error": "<string>",
"message": "<string>",
"attemptsRemaining": 123,
"code": "<string>",
"retryAfterSeconds": 123
}{
"error": "<string>",
"message": "<string>",
"attemptsRemaining": 123,
"code": "<string>",
"retryAfterSeconds": 123
}{
"error": "<string>",
"message": "<string>",
"attemptsRemaining": 123,
"code": "<string>",
"retryAfterSeconds": 123
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Body
application/json