Public Upload Analysis File
curl --request POST \
--url https://public-api.salu.com.vc/dev/routes/v0/analysis/files \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"analysis_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"file_base64": "<string>"
}
'import requests
url = "https://public-api.salu.com.vc/dev/routes/v0/analysis/files"
payload = {
"analysis_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"file_base64": "<string>"
}
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({
analysis_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
name: '<string>',
file_base64: '<string>'
})
};
fetch('https://public-api.salu.com.vc/dev/routes/v0/analysis/files', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://public-api.salu.com.vc/dev/routes/v0/analysis/files",
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([
'analysis_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'name' => '<string>',
'file_base64' => '<string>'
]),
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 := "https://public-api.salu.com.vc/dev/routes/v0/analysis/files"
payload := strings.NewReader("{\n \"analysis_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"name\": \"<string>\",\n \"file_base64\": \"<string>\"\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("https://public-api.salu.com.vc/dev/routes/v0/analysis/files")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"analysis_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"name\": \"<string>\",\n \"file_base64\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://public-api.salu.com.vc/dev/routes/v0/analysis/files")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"analysis_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"name\": \"<string>\",\n \"file_base64\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"file_path": "<string>",
"mimetype": "<string>",
"document_type": "DISABILITY_MEDICAL_REPORT"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Analysis
Upload Analysis File
POST
/
v0
/
analysis
/
files
Public Upload Analysis File
curl --request POST \
--url https://public-api.salu.com.vc/dev/routes/v0/analysis/files \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"analysis_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"file_base64": "<string>"
}
'import requests
url = "https://public-api.salu.com.vc/dev/routes/v0/analysis/files"
payload = {
"analysis_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"file_base64": "<string>"
}
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({
analysis_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
name: '<string>',
file_base64: '<string>'
})
};
fetch('https://public-api.salu.com.vc/dev/routes/v0/analysis/files', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://public-api.salu.com.vc/dev/routes/v0/analysis/files",
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([
'analysis_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'name' => '<string>',
'file_base64' => '<string>'
]),
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 := "https://public-api.salu.com.vc/dev/routes/v0/analysis/files"
payload := strings.NewReader("{\n \"analysis_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"name\": \"<string>\",\n \"file_base64\": \"<string>\"\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("https://public-api.salu.com.vc/dev/routes/v0/analysis/files")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"analysis_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"name\": \"<string>\",\n \"file_base64\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://public-api.salu.com.vc/dev/routes/v0/analysis/files")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"analysis_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"name\": \"<string>\",\n \"file_base64\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"file_path": "<string>",
"mimetype": "<string>",
"document_type": "DISABILITY_MEDICAL_REPORT"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Anexa um documento a uma análise já existente (ex.: laudo de uma
análise PCD). É o passo complementar ao
POST /v0/analysis/disability.Visão Geral
- Método:
POST - Path:
/v0/analysis/files - OperationId:
public_upload_analysis_file_v0_analysis_files_post - Autenticação: header
x-api-key
Campos principais
| Campo | Obrigatório | Significado (PT) |
|---|---|---|
analysis_id | sim | Identificador (UUID) da análise à qual o arquivo será anexado. |
name | sim | Nome do arquivo (com extensão). |
document_type | sim | Tipo do documento. Para análise PCD, use DISABILITY_MEDICAL_REPORT (laudo médico, documento de entrada) ou DISABILITY_CLASSIFICATION (enquadramento PCD, gerado após a avaliação). |
mime_type | sim | MIME type declarado (enum). |
file_base64 | sim | Conteúdo binário do arquivo codificado em base64. |
O conteúdo do arquivo vai inline no corpo, em base64 — não é
multipart/form-data.
Garanta que mime_type corresponde ao conteúdo real do arquivo. O arquivo real é limitado a
aproximadamente 4 MB (a requisição passa por API Gateway + Lambda, com teto de 6 MB, e o
base64 infla o payload em ~33%).Códigos de erro
Além do422 (campos inválidos, incluindo document_type fora do enum aceito):
| Código | Situação |
|---|---|
404 | analysis_id não existe no escopo da chave de API. |
413 | Arquivo maior que o limite suportado (~4 MB reais). |
Exemplo de requisição
curl -X POST "https://public-api.salu.com.vc/dev/routes/v0/analysis/files" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "x-api-key: $SALU_PUBLIC_API_KEY" \
--data '{
"analysis_id": "ANALYSIS_UUID",
"name": "laudo.pdf",
"document_type": "DISABILITY_MEDICAL_REPORT",
"mime_type": "application/pdf",
"file_base64": "JVBERi0xLjQK..."
}'
Authorizations
Body
application/json
Document types specifically for analysis workflows.
Available options:
DISABILITY_MEDICAL_REPORT, DISABILITY_CLASSIFICATION, MEDICAL_CERTIFICATE Available options:
application/pdf, image/jpeg, image/png, image/jpeg Conteúdo binário do arquivo codificado em base64.
Response
Successful Response
Identificador interno do arquivo no storage.
Document types specifically for analysis workflows.
Available options:
DISABILITY_MEDICAL_REPORT, DISABILITY_CLASSIFICATION, MEDICAL_CERTIFICATE