## Retrieve optimization workflow status

### cURL

```
curl --request GET \
  --url https://commerceos.aiagents.fabric.inc/api/v2/optimize/workflows/{workflow_id} \
  --header 'domain: <domain>'
```

### Python

```
import requests

url = "https://commerceos.aiagents.fabric.inc/api/v2/optimize/workflows/{workflow_id}"

headers = {"domain": "<domain>"}

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

print(response.text)
```

### JavaScript

```
const options = {method: 'GET', headers: {domain: '<domain>'}};

fetch('https://commerceos.aiagents.fabric.inc/api/v2/optimize/workflows/{workflow_id}', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
```

### PHP

```
<?php

$curl = curl_init();

curl_setopt_array($curl, [\
  CURLOPT_URL => "https://commerceos.aiagents.fabric.inc/api/v2/optimize/workflows/{workflow_id}",\
  CURLOPT_RETURNTRANSFER => true,\
  CURLOPT_ENCODING => "",\
  CURLOPT_MAXREDIRS => 10,\
  CURLOPT_TIMEOUT => 30,\
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\
  CURLOPT_CUSTOMREQUEST => "GET",\
  CURLOPT_HTTPHEADER => [\
    "domain: <domain>"\
  ],\
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
?>
```

### Go

```
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

url := "https://commerceos.aiagents.fabric.inc/api/v2/optimize/workflows/{workflow_id}"

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

req.Header.Add("domain", "<domain>")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))
}
```

### Java (Unirest)

```
HttpResponse<String> response = Unirest.get("https://commerceos.aiagents.fabric.inc/api/v2/optimize/workflows/{workflow_id}")
  .header("domain", "<domain>")
  .asString();
```

### Ruby

```
require 'uri'
require 'net/http'

url = URI("https://commerceos.aiagents.fabric.inc/api/v2/optimize/workflows/{workflow_id}")

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

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

response = http.request(request)
puts response.read_body
```

### Response

200

401

403

404

500

### Example Workflow State

```
{
  "id": "9349773c-27fe-4d4f-a093-a5793dff8702",
  "brand_id": "691df5949676c8e0b1d7b6b3",
  "type": "OPTIMIZE",
  "origin": "API",
  "mode": "prod",
  "workflow_type": null,
  "status": "REVIEW_PENDING",
  "current_step": "TAXONOMY_MAP",
  "current_hitl_gate": "TAXONOMY_REVIEW",
  "name": "Spring 2026 catalog enrichment",
  "tags": [],
  "started_at": "2026-05-15T10:35:12Z",
  "completed_at": null,
  "last_error": null,
  "retry_count": 0,
  "workflow_metadata": null,
  "progress": {
    "current_phase": "taxonomy",
    "current_step": "TAXONOMY_MAP",
    "current_gate": "TAXONOMY_REVIEW",
    "phases": {
      "validation": {
        "status": "COMPLETED"
      },
      "taxonomy": {
        "status": "REVIEW_PENDING"
      },
      "enrichment": {
        "status": "NOT_STARTED"
      },
      "publish": {
        "status": "NOT_STARTED"
      }
    }
  },
  "review_summary": {
    "total_categories": 12,
    "decided_categories": 3,
    "pending_categories": 9,
    "rerunning_categories": 0,
    "rejected_categories": 0,
    "ready_for_publish_categories": 0,
    "published_categories": 0
  },
  "reviewer_summary": [
    {
      "reviewer_user_id": "user_xyz",
      "name": "Alex Reviewer",
      "email": "alex@acme.com",
      "first_name": "Alex",
      "last_name": "Reviewer",
      "category_ids": [
        "cat_apparel",
        "cat_outerwear"
      ],
      "categories_at_open_gate": 2,
      "current_gate": "TAXONOMY_REVIEW"
    }
  ],
  "created_by": {
    "id": "user_xyz",
    "type": "user",
    "name": "Integration Bot",
    "email": "integration@acme.com"
  },
  "updated_by": {
    "id": "user_xyz",
    "type": "user",
    "name": "Integration Bot",
    "email": "integration@acme.com"
  },
  "created_at": "2026-05-15T10:35:00Z",
  "updated_at": "2026-05-15T10:42:08Z"
}
```

### Error Response

```
{
  "errors": "<array>",
  "message": "Bad request",
  "type": "CLIENT_ERROR"
}
```

### Headers

- **domain:** string required  
  The brand domain name (for example, `vessel.com` or `containerstore.com`) used to scope the request to a specific brand's data and configuration. The authenticated principal must be authorized for the specified brand.  
  Example:  
  `"vessel.com"`

### Path Parameters

- **workflow_id:** string required  
  Workflow identifier returned by `POST /v2/optimize/workflows`.  
  Example:  
  `"9349773c-27fe-4d4f-a093-a5793dff8702"`

### Responses

#### 200

application/json Workflow state  
Workflow state envelope returned by `POST /v2/optimize/workflows` and `GET /v2/optimize/workflows/{workflow_id}`. The `status` value progresses through `PENDING`, then `RUNNING` or `IN_PROGRESS`, then `REVIEW_PENDING`, and ultimately `COMPLETED`. `FAILED` and `CANCELLED` are terminal alternatives.
