# 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}")
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.arcee.ai/arcee-orchestra/workflows/api-invocation/upload-workflow-json-api.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
