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

# Publish automation

POST https://api.athenaintel.com/api/v0/automations/{asset_id}/publish

Compile the draft definition into an immutable, fingerprinted version and materialise its triggers. Idempotent: an unchanged fingerprint records no new version and reconciles the trigger rows in place; triggers that left the definition are paused, never deleted. A definition that does not compile is refused with 400 and every problem listed in detail.issues. When the workspace's approval policy asks for a second person, nothing is published: 202 answers with the publish approval's id, and the draft is published as the caller once that approval is approved.

Reference: https://docs.athenaintel.com/api-reference/automations/publish

## Authentication

- `X-API-KEY` header (required) — API Key authentication via header

## Request

### Path parameters

- `asset_id` (string, required) — Unique identifier of the automation asset

## Response

### 200

Published; version and fingerprint returned

- `asset_id` (string, required)
- `created_version` (boolean, required) — False when the latest version already had this fingerprint
- `fingerprint` (string, required)
- `issues` (list of PublishIssueOut, required) — Compile warnings and post-commit provisioning errors
- `trigger_rows` (list of AutomationPublishTriggerRowOut, required)
- `version` (integer, required)
- `version_id` (string, required)

### 202

Parked for approval by the workspace policy; nothing was published yet

- `any`

## Errors

### 400 Bad Request Error

No draft, or the draft does not compile

- `detail` (PublishRefusedDetailOut, required) — ``detail`` of the 400 a definition that does not compile returns.

### 403 Forbidden Error

The Automations gate denied, or no edit permission

- `detail` (AutomationsDenialDetailOut, required) — ``detail`` of the 403 the Automations gate returns.

### 404 Not Found Error

Not found, or not an automation

- `message` (string, required)

### 422 Unprocessable Entity Error

Validation Error

- `detail` (list of ValidationError, optional)

## Types

### PublishIssueOut

One compile or provisioning finding of a publish.

- `code` (string, required) — Stable code of the finding
- `message` (string, required)
- `path` (string, required) — Where in the definition
- `severity` (enum, required)
  - Allowed values: `error`, `warning`

### AutomationPublishTriggerRowOut

What publish did for one trigger's row(s).

- `action` (string, required) — created | updated | unchanged | paused | re-enabled ...
- `automation_key` (string, required)
- `enabled` (boolean, required)
- `error` (string, required, nullable)
- `kind` (string, required)
- `rule_id` (string, required, nullable)
- `schedule_id` (string, required, nullable)
- `trigger_id` (string, required)

### PublishRefusedDetailOut

``detail`` of the 400 a definition that does not compile returns.

- `issues` (list of PublishIssueOut, required)
- `message` (string, required)
- `code` ("AUTOMATION_PUBLISH_REFUSED", optional, default: AUTOMATION_PUBLISH_REFUSED)

### AutomationsDenialDetailOut

``detail`` of the 403 the Automations gate returns.

- `hint` (string, required) — The next step that lifts the denial
- `message` (string, required) — Human-readable denial
- `reason` (enum, required) — Which of the gate's three checks failed: the deployment has Automations off, the caller is not a member of the workspace, or the workspace is not enrolled
  - Allowed values: `not_provisioned`, `not_permitted`, `workspace_not_enrolled`
- `code` ("AUTOMATIONS_UNAVAILABLE", optional, default: AUTOMATIONS_UNAVAILABLE) — Stable code for a denial by the Automations gate

### ValidationError

- `loc` (list of ValidationErrorLocItems, required)
- `msg` (string, required)
- `type` (string, required)
- `ctx` (ValidationErrorCtx, optional)
- `input` (any, optional)

### ValidationErrorLocItems

- string
- integer

### ValidationErrorCtx

## Examples

### Example 1

**Response**

```json
{
  "asset_id": "asset_92492920-d118-42d3-95b4-00eccfe0754f",
  "created_version": true,
  "fingerprint": "sha256:6f1a…",
  "issues": [],
  "trigger_rows": [
    {
      "action": "created",
      "automation_key": "asset_92492920-d118-42d3-95b4-00eccfe0754f:nightly",
      "enabled": true,
      "error": "string",
      "kind": "schedule",
      "rule_id": "rule_1",
      "schedule_id": "sched_1",
      "trigger_id": "nightly"
    }
  ],
  "version": 1,
  "version_id": "apv_1"
}
```

**SDK Code**

```python
import requests

url = "https://api.athenaintel.com/api/v0/automations/asset_id/publish"

headers = {"X-API-KEY": "<apiKey>"}

response = requests.post(url, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.athenaintel.com/api/v0/automations/asset_id/publish';
const options = {method: 'POST', headers: {'X-API-KEY': '<apiKey>'}};

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"
	"net/http"
	"io"
)

func main() {

	url := "https://api.athenaintel.com/api/v0/automations/asset_id/publish"

	req, _ := http.NewRequest("POST", url, nil)

	req.Header.Add("X-API-KEY", "<apiKey>")

	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.athenaintel.com/api/v0/automations/asset_id/publish")

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

request = Net::HTTP::Post.new(url)
request["X-API-KEY"] = '<apiKey>'

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.post("https://api.athenaintel.com/api/v0/automations/asset_id/publish")
  .header("X-API-KEY", "<apiKey>")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.athenaintel.com/api/v0/automations/asset_id/publish', [
  'headers' => [
    'X-API-KEY' => '<apiKey>',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://api.athenaintel.com/api/v0/automations/asset_id/publish");
var request = new RestRequest(Method.POST);
request.AddHeader("X-API-KEY", "<apiKey>");
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["X-API-KEY": "<apiKey>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.athenaintel.com/api/v0/automations/asset_id/publish")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers

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()
```

### Example 2

**Response**

```json
{
  "asset_id": "asset_92492920-d118-42d3-95b4-00eccfe0754f",
  "created_version": true,
  "fingerprint": "sha256:6f1a…",
  "issues": [],
  "trigger_rows": [
    {
      "action": "created",
      "automation_key": "asset_92492920-d118-42d3-95b4-00eccfe0754f:nightly",
      "enabled": true,
      "error": "string",
      "kind": "schedule",
      "rule_id": "rule_1",
      "schedule_id": "sched_1",
      "trigger_id": "nightly"
    }
  ],
  "version": 1,
  "version_id": "apv_1"
}
```

**SDK Code**

```python
import requests

url = "https://api.athenaintel.com/api/v0/automations/asset_id/publish"

headers = {"X-API-KEY": "<apiKey>"}

response = requests.post(url, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.athenaintel.com/api/v0/automations/asset_id/publish';
const options = {method: 'POST', headers: {'X-API-KEY': '<apiKey>'}};

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"
	"net/http"
	"io"
)

func main() {

	url := "https://api.athenaintel.com/api/v0/automations/asset_id/publish"

	req, _ := http.NewRequest("POST", url, nil)

	req.Header.Add("X-API-KEY", "<apiKey>")

	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.athenaintel.com/api/v0/automations/asset_id/publish")

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

request = Net::HTTP::Post.new(url)
request["X-API-KEY"] = '<apiKey>'

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.post("https://api.athenaintel.com/api/v0/automations/asset_id/publish")
  .header("X-API-KEY", "<apiKey>")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.athenaintel.com/api/v0/automations/asset_id/publish', [
  'headers' => [
    'X-API-KEY' => '<apiKey>',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://api.athenaintel.com/api/v0/automations/asset_id/publish");
var request = new RestRequest(Method.POST);
request.AddHeader("X-API-KEY", "<apiKey>");
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["X-API-KEY": "<apiKey>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.athenaintel.com/api/v0/automations/asset_id/publish")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers

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()
```