Conversations
Upload file with link
Uploads a file with an upload link.
POST
https://api.talktohumans.app
/
v1
/
files
/
uploads
/
{token}
Upload file with link
curl --request POST \
--url https://api.talktohumans.app/v1/files/uploads/{token} \
--header 'Content-Type: multipart/form-data' \
--form file=@example-fileconst form = new FormData();
form.append('file', '<string>');
const options = {method: 'POST'};
options.body = form;
fetch('https://api.talktohumans.app/v1/files/uploads/{token}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.talktohumans.app/v1/files/uploads/{token}"
files = { "file": ("example-file", open("example-file", "rb")) }
response = requests.post(url, files=files)
print(response.text)package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.talktohumans.app/v1/files/uploads/{token}"
payload := strings.NewReader("-----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)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"data": {
"file": {
"file_id": "file_3f2b8c1d9a4e4b7c8d2e1f0a9b8c7d6e",
"kind": "file",
"file_name": "report.pdf",
"mime_type": "application/pdf",
"size_bytes": 225911,
"url": "https://d111111abcdef8.cloudfront.net/file_3f2b8c1d9a4e4b7c8d2e1f0a9b8c7d6e?Signature=abc"
}
}
}{
"code": "bad_request",
"message": "field \"account_id\" must be a string, got number; IDs are strings, e.g. \"42\""
}{
"code": "rate_limit_exceeded",
"message": "Rate limit exceeded"
}{
"code": "internal_error",
"message": "An internal error occurred"
}Path Parameters
Body
multipart/form-data
⌘I
Upload file with link
curl --request POST \
--url https://api.talktohumans.app/v1/files/uploads/{token} \
--header 'Content-Type: multipart/form-data' \
--form file=@example-fileconst form = new FormData();
form.append('file', '<string>');
const options = {method: 'POST'};
options.body = form;
fetch('https://api.talktohumans.app/v1/files/uploads/{token}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.talktohumans.app/v1/files/uploads/{token}"
files = { "file": ("example-file", open("example-file", "rb")) }
response = requests.post(url, files=files)
print(response.text)package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.talktohumans.app/v1/files/uploads/{token}"
payload := strings.NewReader("-----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)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"data": {
"file": {
"file_id": "file_3f2b8c1d9a4e4b7c8d2e1f0a9b8c7d6e",
"kind": "file",
"file_name": "report.pdf",
"mime_type": "application/pdf",
"size_bytes": 225911,
"url": "https://d111111abcdef8.cloudfront.net/file_3f2b8c1d9a4e4b7c8d2e1f0a9b8c7d6e?Signature=abc"
}
}
}{
"code": "bad_request",
"message": "field \"account_id\" must be a string, got number; IDs are strings, e.g. \"42\""
}{
"code": "rate_limit_exceeded",
"message": "Rate limit exceeded"
}{
"code": "internal_error",
"message": "An internal error occurred"
}