> For the complete documentation index, see [llms.txt](https://docs.arcee.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.arcee.ai/arcee-orchestra/workflows/api-invocation/upload-workflow-json-api.md).

# Upload Workflow JSON API

You can Download Workflow JSON in the workflow builder.

<figure><img src="/files/J0lov6T7BhiJ5oLzdrnP" alt=""><figcaption><p>Download workflow JSON in the workflow builder</p></figcaption></figure>

You can edit the JSON programmatically and re-upload it with to following API route. Note: it is best practice to edit an existing workflow structure to preserve node layout and positioning.&#x20;

You can optional upload to a new workflow, or update an existing workflow by including `workflow_id` in the post data.&#x20;

```
import json
import requests
import json
import os
from pathlib import Path

with open("YourJson.json", "r") as f:
    workflow_json = json.load(f)

workflow_json_str = json.dumps(workflow_json)

url = f"{API_BASE_URL}/workflows/upload"
headers = {"Authorization": f"Bearer {API_KEY}"}

# Create files dictionary with the JSON content
files = {
    'workflow_file': ('YourJson.json', workflow_json_str.encode('utf-8'), 'application/json')
}

# Make the request
response = requests.post(
    url,
    headers=headers,
    files=files,
)

# # optionally include workflow_id to update an existing workflow
# # data = {
# #     "workflow_id" : "THE_WORKFLOW_ID"
# # }

# # # Make the request
# # response = requests.post(
# #     url,
# #     data,
# #     headers=headers,
# #     files=files,
# # )

# Print the results
print(f"Status code: {response.status_code}")
print(f"Response: {response.json() if response.status_code == 200 else response.text}")
```
