Skip to main content
PUT
/
v1
/
workflow
/
{workflow_id}
Update Workflow V2
curl --request PUT \
  --url https://api.getbluejay.ai/v1/workflow/{workflow_id} \
  --header 'Content-Type: application/json' \
  --header 'X-API-Key: <x-api-key>' \
  --data '
{
  "name": "<string>",
  "agent_ids": [
    123
  ],
  "description": "<string>",
  "definition": {}
}
'
{
  "id": "<string>",
  "name": "<string>",
  "definition": {},
  "created_at": "2023-11-07T05:31:56Z",
  "organization_id": "<string>",
  "agent_ids": [],
  "description": "<string>",
  "dh_sync_summary": {}
}
Integration Prompt for AI Agents
# Bluejay — Testing & Monitoring Platform for Conversational AI Agents

You are a senior backend engineer integrating the Bluejay API. Think step-by-step: first understand the endpoint, then plan the integration, then implement with minimal changes.

## Update workflow — PUT /v1/workflow/{workflow_id}

> **What this endpoint does:** Partial update. Omitted fields are unchanged. When agent_ids is present in the JSON body (even as [] or null), junction links are replaced atomically: an empty array or null clears all agent links. When definition is present, it is fully replaced and re-validated like on create. The graph must satisfy the same rules and typed shapes as **POST** `/v1/workflow` (see **components**).

**Endpoint:** PUT `https://api.getbluejay.ai/v1/workflow/{workflow_id}`
**Auth:** `X-API-Key` header
**Content-Type:** application/json

### Required Parameters
| Name | Type | Description |
|------|------|-------------|
| X-API-Key | string | API key required to authenticate requests. |

Review the full parameter list at https://docs.getbluejay.ai/api-reference/endpoint/update-workflow and include any optional parameters (e.g., `name`, `agent_ids`, `description`, `definition`) that serve your integration's use case and align with Bluejay's testing and monitoring capabilities.

### Request Body
```json
{
  "name": "example_name",
  "agent_ids": [
    123
  ],
  "description": "string",
  "definition": {
    "nodes": [
      {
        "id": "string",
        "type": "start",
        "position": {
          "x": 1.0,
          "y": 1.0
        },
        "data": {
          "key": "value"
        }
      }
    ],
    "edges": [
      {
        "id": "string",
        "source": "string",
        "target": "string",
        "sourceHandle": "string"
      }
    ],
    "viewport": {
      "key": "value"
    }
  }
}
```

### Example
**PUT with body:**
```python
import requests

def update_workflow(workflow_id: str, payload: dict, api_key: str) -> dict:
    url = f"https://api.getbluejay.ai/v1/workflow/{workflow_id}"
    headers = {"X-API-Key": api_key}
    response = requests.put(url, headers=headers, json=payload)
    response.raise_for_status()
    return response.json()
```

### Constraints
- Minimal changes — only add/change files needed for this integration.
- Match existing codebase patterns (naming, file structure, error handling).
- Include error handling for 400: Invalid definition; 401: Unauthorized; 404: Not found or no access.

### Integration Checklist
Before writing code, verify:
1. Which module/service owns this API domain in the codebase?
2. What HTTP client and error-handling patterns does the project use?
3. Are there existing types/interfaces to extend?

Then implement the integration, export it, and confirm it compiles/passes lint.
Omitted fields are left unchanged. If agent_ids appears in the body (including []), all agent links are replaced; [] clears links. If definition appears, it is fully replaced and validated like POST /v1/workflow (same discriminated node and data types as Create workflow). Sends only the fields you want to change; include definition only when replacing the entire React Flow graph.

Headers

X-API-Key
string
required

API key required to authenticate requests.

Path Parameters

workflow_id
string<uuid>
required

Body

application/json

Partial update for workflows_v2.

name
string | null

New name for the workflow

Required string length: 1 - 255
agent_ids
integer[] | null

Set owning agents, or null to clear agent links (must belong to your organization when set).

description
string | null

New description (set empty string to clear if your client sends it)

definition
Definition · object

Full React Flow definition when replacing the graph. Same shape as create: each node needs a top-level id; each edge needs a top-level id unique among edges.

Response

Successful Response

Single workflows_v2 row.

id
string
required

Workflow ID

name
string
required

Name of the workflow

definition
Definition · object
required

Stored React Flow graph (start / single / options nodes). Nodes and edges use top-level string id fields; edge id values are unique within the graph.

created_at
string<date-time>
required

Creation timestamp

organization_id
string | null

Owning organization ID (set by middleware on create)

agent_ids
integer[]

Linked agent ids when the workflow is agent-scoped

description
string | null

Description

dh_sync_summary
Dh Sync Summary · object

Present on PUT responses when the definition was updated. Keys: updated, created, marked_stale, skipped, errors.