---
title: "Deploy and publish a workflow"
description: "Upload reviewed workflow YAML and expose one revision to Agents."
image: "https://help.agent.mq/og.svg"
---

> Documentation Index
> Fetch the complete documentation index at: https://help.agent.mq/llms.txt
> Use this file to discover all available pages before exploring further.

# Deploy and publish a workflow

## Prerequisites

Use an application you can write. The workflow must use only task types admitted for application workspaces.

1. **Upload one workflow**

```bash
curl -X PUT https://api.agent.mq/v1/applications/app_<32-lowercase-hex>/flows \
  -H "Authorization: Bearer $AGENTMQ_TOKEN" \
  -H "Content-Type: text/plain" \
  --data-binary @workflow.yaml
```

   The YAML is limited to 512,000 characters. Its tenant ID must equal the application ID, and it needs an `id` and `namespace`.
2. **Publish the workflow as an operation**

   `PUT /v1/applications/{appId}/workflow-operations/{id}` pins the current workflow revision and records its name and whether it requires an end user.
3. **Discover it with an Agent key**

   The published operation appears in `GET /v1/agent/applications/{appId}/operations` with a generated input schema.

## Verify

`GET /v1/applications/{appId}/workflow-operations` returns the published revision. Withdrawing it prevents new Agent calls without changing historical receipts.

## Next steps

- [Invoke an operation safely](/build/invoke)
- [Receipts and result retention](/operate/receipts)

Source: https://help.agent.mq/automation/workflows/index.mdx
