> For the complete documentation index, see [llms.txt](https://synap.ac/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://synap.ac/docs/api/reference/automation/create-automation.md). Agents can also search and read this documentation through its [MCP server](https://synap.ac/docs/~gitbook/mcp).

# Create Automation

Creates a disabled automation at version 1 from a name and a workflow definition. The definition must be built against the current catalogue; every structural or semantic fault is returned as its own error pointing into `/data/attributes/definition`. Needs a portal admin; answers 404 for a portal without the automations rollout. The Automations entitlement is only required to enable an automation.

```json
{"openapi":"3.0.1","info":{"title":"Synap API","version":"3.0.0"},"tags":[{"name":"Automation","description":"Endpoints for building and running automations: the block catalogue the workflow builder and the automations engine work from."}],"servers":[{"url":"https://api.synap.ac/v3","description":"Production"},{"url":"https://api-stage.synap.ac/v3","description":"Staging"}],"security":[{"SessionAuth":[]},{"PATAuth":[]},{"AutomationAuth":[]},{"LegacySessionAuth":[]}],"components":{"securitySchemes":{"SessionAuth":{"type":"http","scheme":"bearer","description":"Authorize the request using a Session Token.","bearerFormat":"r:<token>"},"PATAuth":{"type":"http","scheme":"bearer","description":"Authorise the request using a personal access token.","bearerFormat":"p:"},"AutomationAuth":{"type":"http","scheme":"bearer","description":"Authorise the request with a short-lived token signed by the automations engine on behalf of a workflow owner.","bearerFormat":"a:<token>"},"LegacySessionAuth":{"type":"apiKey","description":"[Legacy] Authorize the request using a Session Token.","in":"header","name":"X-Syn-Session-Token"}},"schemas":{"Automation":{"type":"object","required":["id","type"],"properties":{"id":{"$ref":"#/components/schemas/ObjectId"},"type":{"type":"string","description":"Identifies the Resource.","enum":["Automation"]},"attributes":{"type":"object","properties":{"name":{"type":"string","minLength":1,"readOnly":false,"nullable":false},"description":{"type":"string","maxLength":500,"readOnly":false,"nullable":true},"definition":{"type":"object","description":"The workflow definition: `WorkflowDefinitionSchema` from `@synap-ac/automations-contracts`. Validated structurally and against the current catalogue; every fault is reported as its own error with a `source.pointer` into the definition and the issue `code` in `meta`. Saving a new definition bumps `version` and re-derives `triggerEvent`.","additionalProperties":true,"readOnly":false,"nullable":false},"state":{"type":"string","enum":["draft","enabled","disabled","paused"],"description":"Writable to move the automation: `enabled`, `paused` (from enabled, with `waitingRuns`) or `disabled`. Created as `disabled`.","readOnly":false,"nullable":false},"waitingRuns":{"type":"string","enum":["pause","continue"],"description":"Required when pausing: whether runs waiting on a checkpoint pause with the automation or continue. Never returned.","writeOnly":true,"nullable":false},"pausedRuns":{"type":"string","enum":["resume","discard"],"description":"Required when enabling a paused automation: whether paused runs resume (on the current version) or are discarded. Never returned.","writeOnly":true,"nullable":false},"enabled":{"type":"boolean","readOnly":true,"nullable":false},"pausedReason":{"type":"string","enum":["health","blockRetired","entitlementRemoved",null],"readOnly":true,"nullable":true},"version":{"type":"integer","minimum":1,"readOnly":true,"nullable":false},"triggerEvent":{"type":"string","enum":["assignment.complete","attempt.submitted","attempt.complete","attempt.started","attemptOverride.created","attemptCertificate.generated","exam.userRegistered","exam.submitted","exam.started","exam.complete","exam.released","exam.examCreated","exam.examUpdated","flag.planted","learningRecord.created","learningRecord.updated","learningRecord.deleted","store.purchase","usergroup.userAdded","usergroup.userRemoved","invite.sent","user.registered","user.updated","subPortal.created","subPortal.updated","subPortal.deleted","markingSession.started","markingSession.completed","markingState.updated","automationRun.completed"],"readOnly":true,"nullable":false},"health":{"type":"object","required":["consecutiveFailures"],"properties":{"consecutiveFailures":{"type":"integer","minimum":0},"lastRunAt":{"type":"string","format":"date-time","readOnly":true},"lastRunStatus":{"type":"string","enum":["pending","running","waiting","paused","completed","skipped","failed","exhausted","cancelled"],"readOnly":true}},"readOnly":true,"nullable":false},"createdAt":{"type":"string","format":"date-time","readOnly":true,"nullable":false},"updatedAt":{"type":"string","format":"date-time","readOnly":true,"nullable":false}}},"relationships":{"type":"object","properties":{"owner":{"type":"object","description":"This is a resource linkage for a to-one relationship. It is like a Parse Pointer.","readOnly":true,"properties":{"data":{"type":"object","required":["id","type"],"nullable":true,"properties":{"id":{"$ref":"#/components/schemas/ObjectId"},"type":{"type":"string","description":"Identifies the Resource.","enum":["User"]}}}}}}}}},"ObjectId":{"type":"string","description":"The primary key for each resource."},"BackgroundJob":{"type":"object","required":["id","type"],"properties":{"id":{"$ref":"#/components/schemas/ObjectId"},"type":{"type":"string","description":"Identifies the Resource.","enum":["BackgroundJob"]},"attributes":{"type":"object","properties":{"id":{"type":"string","readOnly":true},"createdAt":{"type":"string","readOnly":true},"timeStarted":{"type":"string","readOnly":true},"timeCompleted":{"type":"string","readOnly":true},"name":{"type":"string","readOnly":true},"status":{"type":"string","enum":["queued","delayed","started","stalled","successful","failed","panic"],"readOnly":true},"progress":{"type":"number","readOnly":true},"message":{"type":"string","readOnly":true},"data":{"type":"array","readOnly":true,"items":{"type":"array","readOnly":true,"items":{"oneOf":[{"type":"string"},{"type":"object"}],"maxItems":2}}},"params":{"type":"object","readOnly":true},"error":{"type":"string","readOnly":true},"result":{"type":"object","readOnly":true,"nullable":true}}},"relationships":{"type":"object","properties":{}}}},"BadRequestApiError":{"type":"object","description":"The request was invalid.","properties":{"id":{"type":"string","description":"Unique ID of this error occurrence."},"status":{"type":"string","description":"HTTP status code."},"code":{"type":"string","description":"Synap internal error code."},"title":{"type":"string"},"detail":{"type":"string"},"source":{"type":"object","properties":{"pointer":{"type":"string"},"parameter":{"type":"string"}}}}},"UnauthorizedApiError":{"type":"object","description":"Unauthorized request.","properties":{"id":{"type":"string","description":"Unique ID of this error occurrence."},"status":{"type":"string","description":"HTTP status code."},"code":{"type":"string","description":"Synap internal error code."},"title":{"type":"string"},"detail":{"type":"string"},"source":{"type":"object","properties":{"pointer":{"type":"string"},"parameter":{"type":"string"}}}}},"ForbiddenApiError":{"type":"object","description":"Forbidden request.","properties":{"id":{"type":"string","description":"Unique ID of this error occurrence."},"status":{"type":"string","description":"HTTP status code."},"code":{"type":"string","description":"Synap internal error code."},"title":{"type":"string"},"detail":{"type":"string"},"source":{"type":"object","properties":{"pointer":{"type":"string"},"parameter":{"type":"string"}}}}},"NotFoundApiError":{"type":"object","description":"The request resource could not be found.","properties":{"id":{"type":"string","description":"Unique ID of this error occurrence."},"status":{"type":"string","description":"HTTP status code."},"code":{"type":"string","description":"Synap internal error code."},"title":{"type":"string"},"detail":{"type":"string"},"source":{"type":"object","properties":{"pointer":{"type":"string"},"parameter":{"type":"string"}}}}},"ApiError":{"type":"object","description":"This is an error response structure. The id, status, code, title and detail will vary based on the error situation.","properties":{"id":{"type":"string","description":"Unique ID of this error occurrence."},"status":{"type":"string","description":"HTTP status code."},"code":{"type":"string","description":"Synap internal error code."},"title":{"type":"string"},"detail":{"type":"string"},"source":{"type":"object","properties":{"pointer":{"type":"string"},"parameter":{"type":"string"}}}}}}},"paths":{"/automations":{"post":{"summary":"Create Automation","description":"Creates a disabled automation at version 1 from a name and a workflow definition. The definition must be built against the current catalogue; every structural or semantic fault is returned as its own error pointing into `/data/attributes/definition`. Needs a portal admin; answers 404 for a portal without the automations rollout. The Automations entitlement is only required to enable an automation.","tags":["Automation"],"parameters":[],"requestBody":{"required":true,"content":{"application/vnd.api+json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"type":"object","required":["type","attributes"],"properties":{"type":{"type":"string","description":"Identifies the Resource.","enum":["Automation"]},"attributes":{"type":"object","required":["name","definition"],"properties":{"name":{"type":"string","minLength":1,"readOnly":false,"nullable":false},"description":{"type":"string","maxLength":500,"readOnly":false,"nullable":true},"definition":{"type":"object","description":"The workflow definition: `WorkflowDefinitionSchema` from `@synap-ac/automations-contracts`. Validated structurally and against the current catalogue; every fault is reported as its own error with a `source.pointer` into the definition and the issue `code` in `meta`. Saving a new definition bumps `version` and re-derives `triggerEvent`.","additionalProperties":true,"readOnly":false,"nullable":false},"state":{"type":"string","enum":["draft","enabled","disabled","paused"],"description":"Writable to move the automation: `enabled`, `paused` (from enabled, with `waitingRuns`) or `disabled`. Created as `disabled`.","readOnly":false,"nullable":false},"waitingRuns":{"type":"string","enum":["pause","continue"],"description":"Required when pausing: whether runs waiting on a checkpoint pause with the automation or continue. Never returned.","writeOnly":true,"nullable":false},"pausedRuns":{"type":"string","enum":["resume","discard"],"description":"Required when enabling a paused automation: whether paused runs resume (on the current version) or are discarded. Never returned.","writeOnly":true,"nullable":false},"enabled":{"type":"boolean","readOnly":true,"nullable":false},"pausedReason":{"type":"string","enum":["health","blockRetired","entitlementRemoved",null],"readOnly":true,"nullable":true},"version":{"type":"integer","minimum":1,"readOnly":true,"nullable":false},"triggerEvent":{"type":"string","enum":["assignment.complete","attempt.submitted","attempt.complete","attempt.started","attemptOverride.created","attemptCertificate.generated","exam.userRegistered","exam.submitted","exam.started","exam.complete","exam.released","exam.examCreated","exam.examUpdated","flag.planted","learningRecord.created","learningRecord.updated","learningRecord.deleted","store.purchase","usergroup.userAdded","usergroup.userRemoved","invite.sent","user.registered","user.updated","subPortal.created","subPortal.updated","subPortal.deleted","markingSession.started","markingSession.completed","markingState.updated","automationRun.completed"],"readOnly":true,"nullable":false},"health":{"type":"object","required":["consecutiveFailures"],"properties":{"consecutiveFailures":{"type":"integer","minimum":0},"lastRunAt":{"type":"string","format":"date-time","readOnly":true},"lastRunStatus":{"type":"string","enum":["pending","running","waiting","paused","completed","skipped","failed","exhausted","cancelled"],"readOnly":true}},"readOnly":true,"nullable":false},"createdAt":{"type":"string","format":"date-time","readOnly":true,"nullable":false},"updatedAt":{"type":"string","format":"date-time","readOnly":true,"nullable":false}}},"relationships":{"type":"object","properties":{}}}}}}}}},"responses":{"201":{"description":"Created","content":{"application/vnd.api+json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Automation"}}}}}},"202":{"description":"Accepted","content":{"application/vnd.api+json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/BackgroundJob"}}}}}},"400":{"description":"Bad Request","content":{"application/vnd.api+json":{"schema":{"type":"object","properties":{"errors":{"type":"array","items":{"$ref":"#/components/schemas/BadRequestApiError"}}}}}}},"401":{"description":"Unauthorized","content":{"application/vnd.api+json":{"schema":{"type":"object","properties":{"errors":{"type":"array","items":{"$ref":"#/components/schemas/UnauthorizedApiError"}}}}}}},"403":{"description":"Forbidden","content":{"application/vnd.api+json":{"schema":{"type":"object","properties":{"errors":{"type":"array","items":{"$ref":"#/components/schemas/ForbiddenApiError"}}}}}}},"404":{"description":"Not Found","content":{"application/vnd.api+json":{"schema":{"type":"object","properties":{"errors":{"type":"array","items":{"$ref":"#/components/schemas/NotFoundApiError"}}}}}}},"409":{"description":"Conflict","content":{"application/vnd.api+json":{"schema":{"type":"object","properties":{"errors":{"type":"array","items":{"$ref":"#/components/schemas/ApiError"}}}}}}}},"operationId":"automation.createAutomation"}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://synap.ac/docs/api/reference/automation/create-automation.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
