Skip to main content

Endpoint

POST /tasks/{task_id}/upload-signed-document

Authentication

This endpoint requires authentication via API key. Include your API key in the X-API-Key header:
X-API-Key: ca_your_api_key_here

Path Parameters

ParameterTypeRequiredDescription
task_idintegerYesUnique identifier for the task

Request Body

The request body must be a JSON object with the following fields:

Required Fields

FieldTypeDescription
step_run_idstringID of the signature step run
fileobjectSigned document file to upload. See File Object

File Object Fields

FieldTypeDescription
filenamestringFilename, e.g. signed_contract.pdf
base64_contentstringBase64-encoded file content

Request Example

curl -X POST "https://platform.chamelio.ai/tasks/12345/upload-signed-document" \
  -H "X-API-Key: ca_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "step_run_id": "sr_abc123",
    "file": {
      "filename": "signed_contract.pdf",
      "base64_content": "JVBERi0xLjcKJ..."
    }
  }'
import base64
import requests

task_id = 12345

with open("signed_contract.pdf", "rb") as f:
    content = base64.b64encode(f.read()).decode("utf-8")

url = f"https://platform.chamelio.ai/tasks/{task_id}/upload-signed-document"
headers = {
    "X-API-Key": "ca_your_api_key_here",
    "Content-Type": "application/json"
}

payload = {
    "step_run_id": "sr_abc123",
    "file": {
        "filename": "signed_contract.pdf",
        "base64_content": content
    }
}

response = requests.post(url, json=payload, headers=headers)
print(response.json())
const taskId = 12345;

const response = await fetch(
  `https://platform.chamelio.ai/tasks/${taskId}/upload-signed-document`,
  {
    method: 'POST',
    headers: {
      'X-API-Key': 'ca_your_api_key_here',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      step_run_id: 'sr_abc123',
      file: {
        filename: 'signed_contract.pdf',
        base64_content: 'JVBERi0xLjcKJ...'
      }
    })
  }
);

const data = await response.json();
console.log(data);

Response

Success Response

Status Code: 200 OK
{
  "task_id": 12345,
  "success": true,
  "output_variable_id": "signed_document"
}

Response Fields

FieldTypeDescription
task_idintegerID of the task
successbooleanWhether the upload succeeded
output_variable_idstringOutput variable ID for the signed document

Error Responses

401 Unauthorized

Returned when authentication fails. See the authentication errors section for details.
{
  "detail": "Invalid API key"
}

404 Not Found

Returned when the task doesn’t exist or you don’t have access to it.
{
  "detail": "Task not found"
}

409 Conflict

Returned when the task is not at a signature step or the document cannot be attached in the current state.
{
  "detail": "Task is not at a signature step"
}

422 Validation Error

Returned when the request body is invalid.
{
  "detail": [
    {
      "loc": ["body", "step_run_id"],
      "msg": "field required",
      "type": "value_error.missing"
    }
  ]
}

500 Internal Server Error

Returned when the upload fails due to a server error.
{
  "detail": "Failed to upload signed document"
}

Notes

Use this endpoint when a document is signed outside Chamelio (for example, a manually signed PDF) and you need to attach the executed copy to the signature step.
Call Get Signature Details to obtain the step_run_id for the signature step before uploading.

Use Cases

This endpoint is useful for:
  • Manual signing flows - Attach wet-signed or externally signed documents to a task
  • Third-party signature providers - Record the executed document from a provider not integrated with Chamelio
  • Audit completeness - Ensure the final signed copy is stored against the workflow step