curl --request POST \
--url https://anythingmd.com/api/v1/uploads \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"fileName": "<string>",
"fileType": "<string>",
"idempotencyKey": "<string>",
"content_hash": "<string>",
"contentHash": "<string>"
}
'import requests
url = "https://anythingmd.com/api/v1/uploads"
payload = {
"fileName": "<string>",
"fileType": "<string>",
"idempotencyKey": "<string>",
"content_hash": "<string>",
"contentHash": "<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({
fileName: '<string>',
fileType: '<string>',
idempotencyKey: '<string>',
content_hash: '<string>',
contentHash: '<string>'
})
};
fetch('https://anythingmd.com/api/v1/uploads', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://anythingmd.com/api/v1/uploads"
payload := strings.NewReader("{\n \"fileName\": \"<string>\",\n \"fileType\": \"<string>\",\n \"idempotencyKey\": \"<string>\",\n \"content_hash\": \"<string>\",\n \"contentHash\": \"<string>\"\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))
}{
"documentId": "<string>",
"uploadUrl": "<string>",
"accessUrl": "<string>",
"objectKey": "<string>",
"expiresAt": "2023-11-07T05:31:56Z"
}{
"documentId": "<string>",
"uploadUrl": "<string>",
"accessUrl": "<string>",
"objectKey": "<string>",
"expiresAt": "2023-11-07T05:31:56Z"
}{
"error": "<string>",
"code": "<string>"
}{
"error": "<string>",
"code": "<string>"
}{
"error": "<string>",
"code": "<string>"
}{
"error": "<string>",
"code": "<string>"
}Create a staged upload
Returns a documentId and a signed uploadUrl. PUT the file bytes to uploadUrl, then create a job with source.type: "document" and the documentId.
curl --request POST \
--url https://anythingmd.com/api/v1/uploads \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"fileName": "<string>",
"fileType": "<string>",
"idempotencyKey": "<string>",
"content_hash": "<string>",
"contentHash": "<string>"
}
'import requests
url = "https://anythingmd.com/api/v1/uploads"
payload = {
"fileName": "<string>",
"fileType": "<string>",
"idempotencyKey": "<string>",
"content_hash": "<string>",
"contentHash": "<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({
fileName: '<string>',
fileType: '<string>',
idempotencyKey: '<string>',
content_hash: '<string>',
contentHash: '<string>'
})
};
fetch('https://anythingmd.com/api/v1/uploads', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://anythingmd.com/api/v1/uploads"
payload := strings.NewReader("{\n \"fileName\": \"<string>\",\n \"fileType\": \"<string>\",\n \"idempotencyKey\": \"<string>\",\n \"content_hash\": \"<string>\",\n \"contentHash\": \"<string>\"\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))
}{
"documentId": "<string>",
"uploadUrl": "<string>",
"accessUrl": "<string>",
"objectKey": "<string>",
"expiresAt": "2023-11-07T05:31:56Z"
}{
"documentId": "<string>",
"uploadUrl": "<string>",
"accessUrl": "<string>",
"objectKey": "<string>",
"expiresAt": "2023-11-07T05:31:56Z"
}{
"error": "<string>",
"code": "<string>"
}{
"error": "<string>",
"code": "<string>"
}{
"error": "<string>",
"code": "<string>"
}{
"error": "<string>",
"code": "<string>"
}Authorizations
Create a key under Settings → API Keys and send it as Authorization: Bearer amd_live_…. See https://docs.anythingmd.com/authentication.
Headers
If reused within the retention window, replay the original result instead of a second mutation
1Body
Original file name used for the object key and metadata
1MIME type of the file being uploaded
1If the same key is reused within the idempotency window, return the original upload slot instead of creating a duplicate
1Optional SHA-256 payload checksum (e.g. sha256:)
1Alias for content_hash
1Response
Existing upload slot returned for a replayed idempotency key
Id of an uploaded source document
1Pre-signed URL for HTTP PUT of the file bytes
Object URL the conversion worker will read after upload
Storage object key for the uploaded file
ISO-8601 expiry of the pre-signed upload URL, if known
^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$