> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.simplified.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.simplified.com/_mcp/server.

# Flows · Authoring · Write the step graph, or edit title and description

PATCH https://api.simplified.com/api/v1/workflows/workflows/{workflow_id}
Content-Type: application/json

Updates a workflow. The step graph is written here, as `extra.diagram`.

**Read `resource: workflow://diagram-grammar` before writing a diagram.**
It carries the block and connection grammar, variable references, a
worked example, and the publish failures worth knowing. The grammar is
not guessable from this schema.

The essentials, so a diagram can be sanity-checked without leaving this
tool:

* Blocks are `start`, `end`, and `<action_slug>_<index>` (e.g.
  `call_agent_ai_v2_0`). `data.reference` is the slug without the index.
* Connections join `o/<source_id>/main` to `i/<target_id>/main`.
* Step config goes in `data.config.formData.inputParameters`.
* `${workflow.input.<name>}` reads an input;
  `${<block_id>.output.<path>}` reads an earlier step.
* Declaring an input takes **two** places: `extra.inputs` *and* a
  `dataSchema` on the `start` block. Only one leaves the input
  invisible when the workflow is run.
* You author `diagram`. `conductor` is compiled from it at publish and
  overwritten, so writing it achieves nothing.

Sending `extra` replaces it wholesale — include the complete diagram,
not just what changed. `version` and `skip_credit_usage` are ignored
here; publishing manages the version.

Saved changes are not live. The workflow must be published again before
new runs use them.

Reference: https://docs.simplified.com/api-reference/workflows/authoring/update-workflow

## Authentication

- `Authorization` header (required) (prefixed with ` Api-Key   `) — Header authentication of the form `Api-Key  <token>`
- `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer <token>`, where token is your auth token.

## Request

### Path parameters

- `workflow_id` (integer, required) — Numeric workflow-definition ID. Not a run ID.

### Body (application/json)

This endpoint expects an object.

- `title` (string, optional)
- `description` (string, optional)
- `extra` (map from string to any, optional) — Carries `inputs` and `diagram`. Replaces the stored value wholesale — send the complete diagram.

## Response

### 200

Saved. `has_unpublished_changes` is now true.

## Errors

### 400 Bad Request Error

The diagram failed validation. The message names the offending block where it can.

- `any`

### 404 Not Found Error

No such workflow in this workspace.

- `any`

## Examples

**Request**

```json
{}
```

**Response**

```json
{}
```

**SDK Code**

```python
import requests

url = "https://api.simplified.com/api/v1/workflows/workflows/1"

payload = {}
headers = {
    "Authorization": "Api-Key  <apiKey>",
    "Content-Type": "application/json"
}

response = requests.patch(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.simplified.com/api/v1/workflows/workflows/1';
const options = {
  method: 'PATCH',
  headers: {Authorization: 'Api-Key  <apiKey>', 'Content-Type': 'application/json'},
  body: '{}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.simplified.com/api/v1/workflows/workflows/1"

	payload := strings.NewReader("{}")

	req, _ := http.NewRequest("PATCH", url, payload)

	req.Header.Add("Authorization", "Api-Key  <apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.simplified.com/api/v1/workflows/workflows/1")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Api-Key  <apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.patch("https://api.simplified.com/api/v1/workflows/workflows/1")
  .header("Authorization", "Api-Key  <apiKey>")
  .header("Content-Type", "application/json")
  .body("{}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('PATCH', 'https://api.simplified.com/api/v1/workflows/workflows/1', [
  'body' => '{}',
  'headers' => [
    'Authorization' => 'Api-Key  <apiKey>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.simplified.com/api/v1/workflows/workflows/1");
var request = new RestRequest(Method.PATCH);
request.AddHeader("Authorization", "Api-Key  <apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "Api-Key  <apiKey>",
  "Content-Type": "application/json"
]
let parameters = [] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.simplified.com/api/v1/workflows/workflows/1")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```