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

# Get Publish State

GET https://api.markup.ai/style-agent/terminology/publish-state

Whether this organization's live terminology is up to date.

Reports when terminology was last published and by whom, when it was last
edited, and a `drift` verdict comparing the two. Also carries the job for a
publish or import in progress, if there is one.

Every kind of edit counts toward `drift` — terms, categories, custom
fields, their ordering, variant settings, and deletions — so anything that
changes what would be published marks the terminology out of date.

For an organization publishing more than one language, `languages` carries
each one separately and `drift` summarises the worst of them, so it never
reports up to date while one language is behind.

Reference: https://docs.markup.ai/developer-reference/api-reference/style-agent/terminology/get-publish-state

## Authentication

- `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer <token>`, where token is your auth token.

## Response

### 200

Successful Response

- `drift` (string, required) — `in_sync` (no change recorded since the last publish), `out_of_sync` (changed since the last publish), `never_published`, `publishing` (a publish is running, so the comparison is not meaningful yet), `incomplete` (published but the last build did not finish), or `unknown` (the live state is unavailable). `in_sync` reports that nothing was observed to change, which is not a guarantee that every edit reached the live copy — publish again if in doubt; doing so when already up to date is harmless.
- `language` (string, required) — The language the top-level fields describe. Organizations with terminology in more than one language should read `languages`.
- `last_published_at` (datetime, optional, nullable)
- `last_published_by` (string, optional, nullable)
- `last_compiled_at` (datetime, optional, nullable)
- `last_changed_at` (datetime, optional, nullable) — When this organization's terminology was last edited. Covers every change that affects what gets published — terms, categories, custom fields, ordering, variant settings and deletions. Null if nothing has been edited.
- `languages` (list of PublishLanguageState, optional) — Publish state for every language this organization has terminology in. Terminology tagged as language-independent is published with each of them.
- `active_job` (TerminologyJobResponse, optional, nullable) — Set while a publish or import is in progress.
- `error` (string, optional, nullable) — Set when the live state could not be read; drift is then `unknown`.

## Errors

### 401 Unauthorized Error

Authentication failed or no valid API key provided.

- `detail` (string, required) — A description of the error that occurred.
- `status` (integer, required) — The HTTP status code generated by the server for this issue
- `request_id` (string, required) — A unique ID associated with the HTTP request.

### 403 Forbidden Error

Forbidden

- `detail` (string, required) — A description of the error that occurred.
- `status` (integer, required) — The HTTP status code generated by the server for this issue
- `request_id` (string, required) — A unique ID associated with the HTTP request.

### 500 Internal Server Error

Internal Server Error

- `detail` (string, required) — A description of the error that occurred.
- `status` (integer, required) — The HTTP status code generated by the server for this issue
- `request_id` (string, required) — A unique ID associated with the HTTP request.

## Types

### PublishLanguageState

Publish state for one of the languages an organization publishes.

- `language` (string, required)
- `drift` (string, required) — How this language's live terminology compares to what is stored here. Same values, and the same caveat, as the top-level `drift`.
- `last_published_at` (datetime, optional, nullable)
- `last_compiled_at` (datetime, optional, nullable)

### TerminologyJobResponse

A publish or import running in the background, or the last one that ran.

- `id` (string, required)
- `job_type` (string, required) — Either `publish` or `import`.
- `status` (string, required) — One of `queued`, `running`, `succeeded`, `failed`, or `canceled`. The first two mean the job is still holding the lock.
- `started_at` (datetime, required)
- `stage` (string, optional, nullable) — Coarse progress label while running; null once finished.
- `started_by` (string, optional, nullable) — Who started the job, for display.
- `finished_at` (datetime, optional, nullable)
- `error` (string, optional, nullable) — Why the job failed; null unless status is `failed`.
- `term_count` (integer, optional, nullable) — Terms published, for a successful publish.
- `stats` (map from string to integer, optional, nullable) — Per-record-type counts, for a successful import.
- `languages` (list of TerminologyJobLanguage, optional) — How each language fared, for a publish. Empty for an import, and for publishes that ran before per-language reporting existed.
- `import_term_filters` (list of ImportTermFilterOutcome, optional) — What an import did with each of the legacy terminology's saved term filters. Empty for a publish, and for imports that ran before this was reported.
- `publish_term_filters` (list of PublishTermFilterOutcome, optional) — What a publish did with each filter used for checking. Empty for an import, and for publishes that ran before this was reported.

### TerminologyJobLanguage

How one language's build ended, on a finished publish.

- `language` (string, required)
- `status` (string, required) — `succeeded`, `stored`, `failed`, or `empty`. `empty` means the organization has no terminology at all — a language with none of its own is published as a document with no entries and reports `succeeded`. `stored` means it was published but is not being served, because no language variant is configured for this language; publishing again once one is will serve it.
- `term_count` (integer, optional, default: 0)
- `error` (string, optional, nullable)

### ImportTermFilterOutcome

What an import did with one of the legacy terminology's saved term filters.

- `name` (string, required)
- `outcome` (enum, required) — `imported`: a filter targets used, saved here and used for checking, replacing any filter of the same name. `personal_view`: someone's own Term Browser view, not brought over. `skipped`: a filter targets used that was not brought over; `reason` says why.
  - Allowed values: `imported`, `personal_view`, `skipped`
- `owner` (string, optional, nullable) — The legacy user the filter belonged to.
- `reason` (string, optional, nullable)
- `replaced` (boolean, optional, default: false) — Imported over a filter of the same name made or edited here.

### PublishTermFilterOutcome

What a publish did with one filter used for checking.

- `name` (string, required)
- `outcome` (enum, required) — `published`: sent with the terminology as a term set of its name. `skipped`: not sent; `reason` says why.
  - Allowed values: `published`, `skipped`
- `reason` (string, optional, nullable)
- `term_counts` (map from string to integer, optional) — For a published filter: the terms it was sent with, by language.

## Examples

**Response**

```json
{
  "drift": "string",
  "language": "string",
  "last_published_at": "2024-01-15T09:30:00Z",
  "last_published_by": "string",
  "last_compiled_at": "2024-01-15T09:30:00Z",
  "last_changed_at": "2024-01-15T09:30:00Z",
  "languages": [
    {
      "language": "string",
      "drift": "string",
      "last_published_at": "2024-01-15T09:30:00Z",
      "last_compiled_at": "2024-01-15T09:30:00Z"
    }
  ],
  "active_job": {
    "id": "string",
    "job_type": "string",
    "status": "string",
    "started_at": "2024-01-15T09:30:00Z",
    "stage": "string",
    "started_by": "string",
    "finished_at": "2024-01-15T09:30:00Z",
    "error": "string",
    "term_count": 1,
    "stats": {},
    "languages": [
      {
        "language": "string",
        "status": "string",
        "term_count": 0,
        "error": "string"
      }
    ],
    "import_term_filters": [
      {
        "name": "string",
        "outcome": "imported",
        "owner": "string",
        "reason": "string",
        "replaced": false
      }
    ],
    "publish_term_filters": [
      {
        "name": "string",
        "outcome": "published",
        "reason": "string",
        "term_counts": {}
      }
    ]
  },
  "error": "string"
}
```

**SDK Code**

```python
import requests

url = "https://api.markup.ai/style-agent/terminology/publish-state"

headers = {"Authorization": "Bearer <token>"}

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

print(response.json())
```

```javascript
const url = 'https://api.markup.ai/style-agent/terminology/publish-state';
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

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.markup.ai/style-agent/terminology/publish-state"

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

	req.Header.Add("Authorization", "Bearer <token>")

	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.markup.ai/style-agent/terminology/publish-state")

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

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'

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.get("https://api.markup.ai/style-agent/terminology/publish-state")
  .header("Authorization", "Bearer <token>")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.markup.ai/style-agent/terminology/publish-state', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://api.markup.ai/style-agent/terminology/publish-state");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["Authorization": "Bearer <token>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.markup.ai/style-agent/terminology/publish-state")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
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()
```