Updating document content with API

Tuesday, March 31, 2026
Avatar

Is there any way to update the content of a document through the API? I'm not talking about the information about the document, which can be updated with a PUT call to /projects/{project_id}/documents. I'm talking about the actual binary content of the document.

The only way I can see to update the content of a document programmatically is by uploading a new copy of the document and deleting the existing one.

2 Replies
Wednesday, April 1, 2026
Avatar
re: amcintyre Tuesday, March 31, 2026

Hello,

I think that it is not currently possible - there is no direct “replace binary content” call on an existing document record.

If Spira receives a POST request with a DocumentId that already exists, it will automatically append the new BinaryData as a brand-new version (e.g., v2.0) of that existing document, rather than creating a new record.
So, yes - because Spira uses built-in version control, the correct way to update the content programmatically is to upload the new copy as a new version of the same document.

Why this is the best practice:

- It preserves Links: The DocumentId remains the same, so any existing artifacts linked to this document will now seamlessly point to the newly uploaded version.
- History is being maintained: If you look at the document in the Spira UI, you will see the new binary file as the "Current Version," but users can still go to the "Versions" tab to see the previous iterations.

 

Hope that helps.

 

Regards,
Victoria -

Monday, April 13, 2026
Avatar
re: amcintyre Tuesday, March 31, 2026

Hello!

Most APIs only allow updating document metadata with a PUT call, not the binary content itself. To change the actual file, you typically need to upload a new version and then delete or archive the old one. Some systems expose this as a “replace” or “upload new version” endpoint, but under the hood it’s still a fresh upload—so re‑uploading and removing the old copy is the standard approach unless the API supports explicit versioning.

Spira Helps You Deliver Quality Software, Faster and With Lower Risk

And if you have any questions, please email or call us at +1 (202) 558-6885

 

Statistics
  • Started: Tuesday, March 31, 2026
  • Last Reply: Monday, April 13, 2026
  • Replies: 2
  • Views: 116