TofuPilotTofuPilot
v2 Reference (Preview)/Attachments

Initialize upload

Initialize a temporary upload URL for a file and return it along with the upload ID. This is the first step in the attachment upload process.

API v2 Preview

The TofuPilot API v2.0 is currently in public preview and is subject to change as we stabilize until release (planned for Aug 2025).

Access

API KeyAccess LevelDescription
UserFullUsers can initialize attachment uploads
StationFullStations can initialize attachment uploads

Upload Process

Follow these steps to upload attachments to test runs:

Initialize: Call this endpoint to get a temporary upload URL and attachment ID.

Upload: Send your test image to the provided URL using a PUT request. Common formats include:

  • Images: JPEG, PNG, BMP, TIFF for visual test results, defect photos, or equipment screenshots
  • Documents: PDF for test reports, CSV for measurement data, TXT for logs
  • Binary: Any test output files from your equipment or software

Example for uploading a test image:

curl -X PUT "https://storage-url-from-initialize" \
  -H "Content-Type: image/jpeg" \
  --data-binary "@test_result.jpg"

Update Run: Call the Update Run endpoint with the attachment ID to link it to your test run.

Endpoint

POST/v2/attachments
AuthorizationBearer <token>

API key for authentication. Use format: Bearer YOUR_API_KEY

In: header

namestring

Response Body

from tofupilot.v2 import TofuPilot

# Initialize the TofuPilot client
client = TofuPilot()

# Execute the operation
result = client.attachments.create(
    name="string"
)

# Handle response
print(result)
{
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "upload_url": "string"
}
{
  "code": "BAD_REQUEST",
  "message": "Procedure name is required",
  "issues": []
}
{
  "code": "FORBIDDEN",
  "message": "Part creation failed.; Revision creation failed.; Batch creation failed.; Unit creation failed.; Version creation failed.; Plan upgrade required.; Monthly limit exceeded.",
  "issues": []
}
{
  "code": "NOT_FOUND",
  "message": "Procedure not found: {id}",
  "issues": []
}
{
  "code": "INTERNAL_SERVER_ERROR",
  "message": "Internal server error",
  "issues": []
}
{
  "code": "BAD_GATEWAY",
  "message": "Failed to generate upload URL",
  "issues": []
}

How is this guide?