> For the complete documentation index, see [llms.txt](https://docs-embed.anyflow.jp/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs-embed.anyflow.jp/anyflow-api/vender-server-api.md).

# Vender Server API

## 概要 <a href="#about" id="about"></a>

Vender Server API とは、ベンダーのサーバーサイドから呼び出されることを想定したAPIです。

ベンダーに付与されたAPI Secretを用いて認証を行い呼び出します。

ベースURLは以下のとおりです。

```
https://embed-vender-api.anyflow.jp
```

***

## 認証方法 <a href="#authorization" id="authorization"></a>

ベンダーサーバーAPI を利用するには、あらかじめ API Secret を発行しておく必要があります。\
Secret の設定は[こちら](https://embed.anyflow.jp/settings/api-secret)

<figure><img src="/files/OKNB98p30oH7K881brSb" alt=""><figcaption></figcaption></figure>

発行したAPI Secret を用いて「アクセストークンを取得する」のAPIを呼び出すことで、ベンダーサーバーAPIのためのアクセストークンを取得できます。

アクセストークンは Authorization ヘッダーにセットします。

```
Authorization: Bearer {アクセストークン}
```

### 認証エラー <a href="#authorization-error" id="authorization-error"></a>

認証情報のエラーが発生した際、ステータスコードは 401 になります。認証情報のエラーは原因によって解決可能なものがあります。例えばアクセストークンの有効期限切れです。

有効期限切れのような再度アクセストークンを取得することで解決できる場合、エラーレスポンス内に `"recoverable": true`を返します。

```json
{
  "messsage": "token expired.",
  "detail": {
    "recoverable": true
  }
}
```

ステータスコード 401 でレスポンス中に recoverable を含んでいない、もしくは false の場合はアクセストークンを再取得しても問題を解決できません。

***

## 共通のエラーレスポンス構造 <a href="#common-error" id="common-error"></a>

ベンダーサーバーAPI 全体で共通のエラーレスポンスの構造は以下の通りです。

```json
{
  message: string | null,
  detail: {}
}
```

<table><thead><tr><th width="120.6953125">項目</th><th>内容</th></tr></thead><tbody><tr><td>message</td><td><p>エラー内容が記載されたメッセージです。</p><p>トラブルシュート等のためにご利用ください。<br>メッセージの内容は変更される可能性があるためシステムの制御に利用しないでください。</p></td></tr><tr><td>detail</td><td><p>エラーの原因に関する情報です。</p><p><strong>エラーハンドリングをシステム上で行う場合は、この情報を利用してください。</strong></p><p>内容は API によって変わります。各種 API のエラーレスポンスをご確認ください。</p></td></tr></tbody></table>

***

## APIリファレンス <a href="#api-reference" id="api-reference"></a>

## アクセストークンを取得する

> VenderServer API を実行するためのアクセストークンを取得します。取得したアクセストークンの有効期限は5分間です。

```json
{"openapi":"3.1.0","info":{"title":"Anyflow VenderServer API","version":"1.0"},"servers":[{"url":"https://embed-vender-api.anyflow.jp"}],"security":[],"paths":{"/token":{"post":{"summary":"アクセストークンを取得する","description":"VenderServer API を実行するためのアクセストークンを取得します。取得したアクセストークンの有効期限は5分間です。","operationId":"vender-server-api-post-token","requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["vender_id","secret"],"properties":{"vender_id":{"type":"string","description":"JWTのissの値と同一です。管理画面の[JWTの設定画面](https://embed.anyflow.jp/settings/jwt)から取得します"},"secret":{"type":"string","description":"管理画面の[APIシークレットの設定画面](https://embed.anyflow.jp/settings/api-secret)から取得します"}}}}}},"responses":{"200":{"description":"200","content":{"application/json":{"schema":{"type":"object","properties":{"access_token":{"type":"string"}}}}}}},"deprecated":false}}}}
```

## ソリューション一覧を取得する

> 利用可能なソリューションの一覧を取得します。

```json
{"openapi":"3.1.0","info":{"title":"Anyflow VenderServer API","version":"1.0"},"servers":[{"url":"https://embed-vender-api.anyflow.jp"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"accessToken"}}},"paths":{"/solutions":{"get":{"summary":"ソリューション一覧を取得する","description":"利用可能なソリューションの一覧を取得します。","operationId":"get-solutions","parameters":[{"name":"deploy_environment_unique_name","in":"query","description":"デプロイ環境のユニーク名です。未指定の場合はデフォルトのデプロイ環境を取得します。","required":false,"schema":{"type":"string"}},{"name":"page","in":"query","description":"ページ番号（1以上）","required":false,"schema":{"type":"integer","format":"int32","minimum":1}},{"name":"per_page","in":"query","description":"1ページあたりの件数（1〜100）","required":false,"schema":{"type":"integer","format":"int32","minimum":1,"maximum":100}}],"responses":{"200":{"description":"200","content":{"application/json":{"schema":{"type":"object","properties":{"results":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","description":"ソリューションID"},"name":{"type":"string","description":"ソリューション名"},"description":{"type":"string","description":"ソリューションの説明"},"thumbnail_url":{"type":"string","nullable":true,"description":"サムネイル画像のURL"},"created_at":{"type":"integer","format":"int64","description":"作成日時（ミリ秒）"},"updated_at":{"type":"integer","format":"int64","description":"更新日時（ミリ秒）"}}}}}}}}}},"deprecated":false}}}}
```

## ソリューションインスタンスを検索する

> Requestトリガーを呼び出すためのソリューションインスタンスを検索し取得します。

```json
{"openapi":"3.1.0","info":{"title":"Anyflow VenderServer API","version":"1.0"},"servers":[{"url":"https://embed-vender-api.anyflow.jp"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"accessToken"}}},"paths":{"/solution_instances":{"get":{"summary":"ソリューションインスタンスを検索する","description":"Requestトリガーを呼び出すためのソリューションインスタンスを検索し取得します。","operationId":"get-solution-instances","parameters":[{"name":"solution_id","in":"query","description":"該当のソリューションIDです。","required":true,"schema":{"type":"string"}},{"name":"deploy_environment_unique_name","in":"query","description":"デプロイ環境です。指定しない場合は デフォルトの環境 を取得します。","schema":{"type":"string"}},{"name":"external_team_id","in":"query","description":"JWTのanyflow_team_idの値と同一です。","schema":{"type":"string"}},{"name":"external_user_id","in":"query","description":"JWTのanyflow_user_idの値と同一です。","schema":{"type":"string"}},{"name":"status","in":"query","description":"ワークフローのステータスとしていずれかの値を指定します。","schema":{"type":"string","enum":["enabled","disabled"]}},{"name":"page","in":"query","description":"取得対象のページ番号です。指定しない場合は 1 ページ目を取得します。","schema":{"type":"integer","format":"int32"}},{"name":"per_page","in":"query","description":"1 ページあたりの取得件数（最大100件）です。指定しない場合は 100 件分取得します。","schema":{"type":"integer","format":"int32"}}],"responses":{"200":{"description":"200","content":{"application/json":{"schema":{"type":"object","properties":{"results":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string"}}}}}}}}}},"deprecated":false}}}}
```

## RequestTrigger を発火する

> RequestTriggerを発火させソリューションを実行します。

```json
{"openapi":"3.1.0","info":{"title":"Anyflow VenderServer API","version":"1.0"},"servers":[{"url":"https://embed-vender-api.anyflow.jp"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"accessToken"}}},"paths":{"/request_trigger":{"post":{"summary":"RequestTrigger を発火する","description":"RequestTriggerを発火させソリューションを実行します。","operationId":"vender-server-api-post-request-trigger","requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["solution_instance_id"],"properties":{"solution_instance_id":{"type":"string","description":"ソリューションインスタンス検索APIまたはSDKから取得できます。"},"payload":{"type":"string","description":"ソリューションに設定したリクエストペイロードです。","format":"json"}}}}}},"responses":{"200":{"description":"200","content":{"application/json":{"schema":{"type":"object","properties":{"job":{"type":"object","properties":{"id":{"type":"string"},"state":{"type":"string"}}},"payload":{"type":"object","properties":{}}}}}}},"408":{"description":"408","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"detail":{"type":"object","properties":{"job":{"type":"object","properties":{"id":{"type":"string"}}}}}}}}}}},"deprecated":false}}}}
```


---

# 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs-embed.anyflow.jp/anyflow-api/vender-server-api.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
