Read a file you already have into a draft
const url = 'https://forge.example.com/api/drafts/import';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"systemId":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0","name":"example","classificationKey":"example","visibility":"example","fileName":"example","content":"example","page":1}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://forge.example.com/api/drafts/import \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "systemId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "name": "example", "classificationKey": "example", "visibility": "example", "fileName": "example", "content": "example", "page": 1 }'A Visio drawing (.vsdx), a draw.io diagram, a Microsoft Threat Modeling Tool model (.tm7), a Terraform plan as JSON (terraform show -json), a CloudFormation template, Kubernetes manifests or an Open Threat Model file (0.2.0, JSON or YAML). content is the file as base64, 10 MB at most; fileName is its name; page picks a page of a drawing with several. The other fields are those of a new draft. Every element of the draft is marked as a suggestion, with where in the file it came from, until you confirm it, and importReport says what was read, what was left out and what only a person can answer. No AI is used, so this works where the classification switches the assistant off. Answers 422 with a sentence when the file cannot be read, and 413 when it is too large.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”object
Example generated
{ "systemId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "name": "example", "classificationKey": "example", "visibility": "example", "fileName": "example", "content": "example", "page": 1}Responses
Section titled “Responses”The draft, as getting a draft answers it.
Example generated
exampledefault
Section titled “default”A refusal or an error, as a problem document. A model or draft you may not see answers 404, as one that does not exist.
object
Example generated
{ "type": "example", "title": "example", "status": 1, "detail": "example", "instance": "example"}