Acknowledge file upload(s)
curl --request POST \
--url http://localhost:8787/v1/upload/ack \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
[
{
"upload_id": "123e4567-e89b-12d3-a456-426614174000"
},
{
"upload_id": "223e4567-e89b-12d3-a456-426614174001"
}
]
'import requests
url = "http://localhost:8787/v1/upload/ack"
payload = [{ "upload_id": "123e4567-e89b-12d3-a456-426614174000" }, { "upload_id": "223e4567-e89b-12d3-a456-426614174001" }]
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify([
{upload_id: '123e4567-e89b-12d3-a456-426614174000'},
{upload_id: '223e4567-e89b-12d3-a456-426614174001'}
])
};
fetch('http://localhost:8787/v1/upload/ack', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "8787",
CURLOPT_URL => "http://localhost:8787/v1/upload/ack",
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([
[
'upload_id' => '123e4567-e89b-12d3-a456-426614174000'
],
[
'upload_id' => '223e4567-e89b-12d3-a456-426614174001'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$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 := "http://localhost:8787/v1/upload/ack"
payload := strings.NewReader("[\n {\n \"upload_id\": \"123e4567-e89b-12d3-a456-426614174000\"\n },\n {\n \"upload_id\": \"223e4567-e89b-12d3-a456-426614174001\"\n }\n]")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
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("http://localhost:8787/v1/upload/ack")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("[\n {\n \"upload_id\": \"123e4567-e89b-12d3-a456-426614174000\"\n },\n {\n \"upload_id\": \"223e4567-e89b-12d3-a456-426614174001\"\n }\n]")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:8787/v1/upload/ack")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "[\n {\n \"upload_id\": \"123e4567-e89b-12d3-a456-426614174000\"\n },\n {\n \"upload_id\": \"223e4567-e89b-12d3-a456-426614174001\"\n }\n]"
response = http.request(request)
puts response.read_body[
{
"upload_id": "123e4567-e89b-12d3-a456-426614174000",
"acknowledged_at": "2024-01-01T12:00:00Z",
"size": 1024,
"content_type": "application/pdf"
},
{
"upload_id": "223e4567-e89b-12d3-a456-426614174001",
"error": "Upload is not completed yet"
}
]{
"error": "Validation failed",
"fields": {}
}{
"error": "API key required"
}{
"error": "Upload not found"
}{
"error": "Too many requests, please try again later",
"retryAfter": 123
}{
"error": "Internal server error"
}Upload
Acknowledge file upload(s)
Acknowledges that one or more file uploads have been completed. This endpoint verifies files exist in storage and updates upload records with metadata. Processes multiple uploads in parallel. Each result in the response array may be a success or error object.
POST
/
v1
/
upload
/
ack
Acknowledge file upload(s)
curl --request POST \
--url http://localhost:8787/v1/upload/ack \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
[
{
"upload_id": "123e4567-e89b-12d3-a456-426614174000"
},
{
"upload_id": "223e4567-e89b-12d3-a456-426614174001"
}
]
'import requests
url = "http://localhost:8787/v1/upload/ack"
payload = [{ "upload_id": "123e4567-e89b-12d3-a456-426614174000" }, { "upload_id": "223e4567-e89b-12d3-a456-426614174001" }]
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify([
{upload_id: '123e4567-e89b-12d3-a456-426614174000'},
{upload_id: '223e4567-e89b-12d3-a456-426614174001'}
])
};
fetch('http://localhost:8787/v1/upload/ack', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "8787",
CURLOPT_URL => "http://localhost:8787/v1/upload/ack",
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([
[
'upload_id' => '123e4567-e89b-12d3-a456-426614174000'
],
[
'upload_id' => '223e4567-e89b-12d3-a456-426614174001'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$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 := "http://localhost:8787/v1/upload/ack"
payload := strings.NewReader("[\n {\n \"upload_id\": \"123e4567-e89b-12d3-a456-426614174000\"\n },\n {\n \"upload_id\": \"223e4567-e89b-12d3-a456-426614174001\"\n }\n]")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
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("http://localhost:8787/v1/upload/ack")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("[\n {\n \"upload_id\": \"123e4567-e89b-12d3-a456-426614174000\"\n },\n {\n \"upload_id\": \"223e4567-e89b-12d3-a456-426614174001\"\n }\n]")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:8787/v1/upload/ack")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "[\n {\n \"upload_id\": \"123e4567-e89b-12d3-a456-426614174000\"\n },\n {\n \"upload_id\": \"223e4567-e89b-12d3-a456-426614174001\"\n }\n]"
response = http.request(request)
puts response.read_body[
{
"upload_id": "123e4567-e89b-12d3-a456-426614174000",
"acknowledged_at": "2024-01-01T12:00:00Z",
"size": 1024,
"content_type": "application/pdf"
},
{
"upload_id": "223e4567-e89b-12d3-a456-426614174001",
"error": "Upload is not completed yet"
}
]{
"error": "Validation failed",
"fields": {}
}{
"error": "API key required"
}{
"error": "Upload not found"
}{
"error": "Too many requests, please try again later",
"retryAfter": 123
}{
"error": "Internal server error"
}Authorizations
WorkOS API key for authentication
Body
application/json
The upload ID returned from /prepare endpoint
Example:
"123e4567-e89b-12d3-a456-426614174000"
Example:
[
{
"upload_id": "123e4567-e89b-12d3-a456-426614174000"
},
{
"upload_id": "223e4567-e89b-12d3-a456-426614174001"
}
]
Response
Upload acknowledgment results
- Option 1
- Option 2
Successful acknowledgment
Example:
[
{
"upload_id": "123e4567-e89b-12d3-a456-426614174000",
"acknowledged_at": "2024-01-01T12:00:00Z",
"size": 1024,
"content_type": "application/pdf"
},
{
"upload_id": "223e4567-e89b-12d3-a456-426614174001",
"error": "Upload is not completed yet"
}
]
Was this page helpful?
⌘I