{
  "$id": "https://schemas.mapi.dev/v1/api-Workflow.json",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "description": "A saved workflow (``workflow://project/name``) and its latest revision.",
  "examples": [
    {
      "created_at": "2026-10-15T09:30:00Z",
      "id": "wf_01jaf3e1f2g3h4j5k6m7n8p9q0",
      "latest_revision": 2,
      "name": "ts-readiness",
      "project_id": "growth",
      "ref": "workflow://growth/ts-readiness",
      "tenant_id": "acme",
      "updated_at": "2026-10-15T09:30:00Z"
    }
  ],
  "properties": {
    "archived": {
      "default": false,
      "title": "Archived",
      "type": "boolean"
    },
    "created_at": {
      "format": "date-time",
      "title": "Created At",
      "type": "string"
    },
    "created_by": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Created By"
    },
    "description": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Description"
    },
    "id": {
      "examples": [
        "run_01jaf3q2x8m9v7k5h4g3f2e1d0"
      ],
      "pattern": "^[A-Za-z0-9][A-Za-z0-9_.\\-]{0,127}$",
      "title": "Id",
      "type": "string"
    },
    "latest_revision": {
      "minimum": 1,
      "title": "Latest Revision",
      "type": "integer"
    },
    "name": {
      "title": "Name",
      "type": "string"
    },
    "project_id": {
      "pattern": "^[a-z0-9](?:[a-z0-9_-]{0,62}[a-z0-9])?$",
      "title": "Project Id",
      "type": "string"
    },
    "ref": {
      "description": "workflow://project/name",
      "title": "Ref",
      "type": "string"
    },
    "template": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Gallery template it was created from",
      "title": "Template"
    },
    "tenant_id": {
      "pattern": "^[a-z0-9](?:[a-z0-9_-]{0,62}[a-z0-9])?$",
      "title": "Tenant Id",
      "type": "string"
    },
    "updated_at": {
      "format": "date-time",
      "title": "Updated At",
      "type": "string"
    }
  },
  "required": [
    "id",
    "tenant_id",
    "project_id",
    "name",
    "ref",
    "latest_revision",
    "created_at",
    "updated_at"
  ],
  "title": "Workflow",
  "type": "object",
  "x-mapi-contract-version": "0.2"
}
