Create a staged upload
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>"
}Uploads
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.
POST
/
api
/
v1
/
uploads
Create a staged upload
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
Body
application/json
Response
Existing upload slot returned for a replayed idempotency key
ISO-8601 expiry of the pre-signed upload URL, if known
Pattern:
^(?:(?:\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))$