|
1 | 1 | --- |
2 | | -title: API |
3 | | -keywords: [SmythOS, API deployment, Swagger, OpenAPI, agent API, HTTP integration, OpenAPI URL, chat integration, LLM API] |
4 | | -description: How to use your SmythOS agent via direct API calls using Swagger UI and the OpenAPI schema. |
| 2 | +title: Deploy as API |
| 3 | +sidebar_label: API |
| 4 | +description: Learn how to deploy your SmythOS agent as a REST API with live Swagger testing and a shareable OpenAPI URL. |
| 5 | +keywords: [SmythOS, API deployment, OpenAPI, Swagger, agent API, integrations, REST] |
5 | 6 | --- |
6 | 7 |
|
7 | | -# Use Agent via API |
| 8 | +# Deploy as API |
8 | 9 |
|
9 | | -> **Direct. Documented. Developer-friendly.** Access your agent's endpoints with Swagger UI and OpenAPI. |
10 | | -
|
11 | | -<InfoCallout> |
12 | | -**TL;DR:** Open your agent’s API embodiment, grab the OpenAPI URL, and use the Swagger interface to test, verify, and integrate. |
| 10 | +<InfoCallout title="Quick Steps (TL;DR)"> |
| 11 | +**1.** Open your agent → **Deploy → API → Get Endpoints** |
| 12 | +**2.** Test your endpoints in Swagger |
| 13 | +**3.** Share or import the OpenAPI URL |
13 | 14 | </InfoCallout> |
14 | 15 |
|
15 | | -<Spacer size="md" /> |
16 | | - |
17 | | -## Why Access Your Agent via API? |
18 | | - |
19 | | -This method is ideal if you want to: |
| 16 | +<Spacer size="md" /> |
20 | 17 |
|
21 | | -- Send HTTP requests directly to your agent |
22 | | -- Test behavior and payloads in Swagger before deploying to production |
23 | | -- Integrate with other tools, backends, or systems without using UI elements |
24 | | -- Reuse agent logic across internal apps, CRMs, dashboards, or mobile apps |
| 18 | +## Why Deploy as an API? |
25 | 19 |
|
26 | | -<Spacer size="md" /> |
| 20 | +Deploying as an API turns your agent into a live REST service. You can test it in Swagger, share it with teammates, and integrate it into other apps with standard HTTP calls. Ideal for connecting workflows, building automations, and verifying inputs and outputs quickly. |
27 | 21 |
|
28 | | -## What You Need Before You Start |
| 22 | +<Spacer size="md" /> |
29 | 23 |
|
30 | | -Before interacting with the API embodiment, make sure: |
| 24 | +## Prerequisites |
31 | 25 |
|
32 | | -- Your agent is deployed (test, production, or versioned) |
33 | | -- You have a Vault API key with the correct scopes |
34 | | -- You know your environment’s [subdomain](/docs/agent-deployments/subdomains) URL (`stage` or `pstage`) |
| 26 | +- Your agent is [deployed](/docs/agent-deployments/overview) |
35 | 27 |
|
36 | | -<Spacer size="md" /> |
| 28 | +<Spacer size="md" /> |
37 | 29 |
|
38 | | -## Step-by-Step: Use the SmythOS Agent API |
| 30 | +## Step 1: Open the Deploy Panel |
39 | 31 |
|
40 | | -### Step 1: Open the API Embodiment in Your Dashboard |
| 32 | +1. Open your agent in the canvas |
| 33 | +2. Click **Deploy** at the top right |
| 34 | +3. In **Embed**, select **API** and click **Get Endpoints** |
41 | 35 |
|
42 | | -1. Navigate to your agent’s **Deployments** tab |
43 | | -2. Find and click on the **API** embodiment in the Environment section |
44 | | -3. A Swagger UI will load with all available endpoints |
45 | | - |
46 | | -<InfoCallout> |
47 | | -Each endpoint maps to a callable block or function in your agent logic. |
48 | | -</InfoCallout> |
| 36 | +<Image |
| 37 | + src="/docs/img/agent_deployments/api-get-endpoints-deploy.png" |
| 38 | + alt="Deploy panel showing API Get Endpoints option" |
| 39 | +/> |
49 | 40 |
|
50 | | -<Spacer size="md" /> |
| 41 | +This opens the **API Endpoints** window with live Swagger and your OpenAPI URL. |
51 | 42 |
|
52 | | -### Step 2: Get the OpenAPI URL for Your Agent |
| 43 | +<Spacer size="md" /> |
53 | 44 |
|
54 | | -The OpenAPI schema is located at: |
| 45 | +## Step 2: Review the API Endpoints |
55 | 46 |
|
56 | | -```text |
57 | | -https://<your-agent-subdomain>/api-docs/openapi.json |
58 | | -``` |
| 47 | +You will see: |
59 | 48 |
|
60 | | -Examples: |
| 49 | +* **Dev API** and optional **Prod API** URL fields |
| 50 | +* Live **Swagger UI** to try requests |
| 51 | +* An **OpenAPI URL** for imports |
61 | 52 |
|
62 | | -```text |
63 | | -Test: https://salesbot.agent.stage.smyth.ai/api-docs/openapi.json |
64 | | -Prod: https://salesbot.agent.pstage.smyth.ai/api-docs/openapi.json |
65 | | -``` |
| 53 | +<Image |
| 54 | + src="/docs/img/agent_deployments/api-endpoints-deploy.png" |
| 55 | + alt="API Endpoints modal showing Swagger and OpenAPI URL" |
| 56 | +/> |
66 | 57 |
|
67 | | -You can import this URL into third-party tools like Postman or [GPT Builder](/docs/agent-deployments/deployments/deploy-as-chatgpt). |
| 58 | +<TipCallout title="Dev vs Prod"> |
| 59 | +Use Dev while building. Add Prod when your agent is stable and ready for wider use. |
| 60 | +</TipCallout> |
68 | 61 |
|
69 | | -<PromptCard prompt="Paste your OpenAPI URL into tools like Swagger, Postman, or GPT Builder to explore endpoints." /> |
| 62 | +<Spacer size="md" /> |
70 | 63 |
|
71 | | -<Spacer size="md" /> |
| 64 | +## Step 3: Test Directly in SmythOS |
72 | 65 |
|
73 | | -### Step 3: Test and Explore Endpoints with Swagger |
| 66 | +1. Click **Test** on the top toolbar |
| 67 | +2. Open the **API** tab in the right dock |
| 68 | +3. Choose an operation → **Try it out** → fill fields → **Execute** |
74 | 69 |
|
75 | | -1. Select your **Server** from the dropdown (e.g., test or production) |
76 | | -2. Click on any endpoint to expand it |
77 | | -3. Click **Try it out** to activate edit mode |
78 | | -4. Modify the payload as needed |
79 | | -5. Click **Execute** to send the request and view the response |
| 70 | +<Image |
| 71 | + src="/docs/img/agent_deployments/api-test.png" |
| 72 | + alt="Testing API endpoints directly in SmythOS canvas" |
| 73 | +/> |
80 | 74 |
|
81 | | -<WarningCallout> |
82 | | -Swagger does not support multi-line JSON by default. Keep payloads single-line or escape newline characters. |
83 | | -</WarningCallout> |
| 75 | +<TipCallout title="Testing is key"> |
| 76 | +Testing here is the fastest way to validate requests and responses before any external integration. |
| 77 | +</TipCallout> |
84 | 78 |
|
85 | | -<Spacer size="md" /> |
| 79 | +<Spacer size="md" /> |
86 | 80 |
|
87 | | -## What Comes After API Integration? |
| 81 | +## Share and Integrate |
88 | 82 |
|
89 | | -Now that your API is live: |
| 83 | +- Share the **OpenAPI URL** by copying the OpenAPI URL from API Endpoints so teammates can explore your API in their tools |
| 84 | +- Import into Postman or SwaggerHub for collaboration and documentation |
| 85 | +- Call the API from apps and automations using standard HTTP\ |
| 86 | +- Use Dev while iterating and switch to Prod when ready to go live |
90 | 87 |
|
91 | | -- Monitor usage from **Deployments → Logs** |
92 | | -- Use the same OpenAPI URL in SDKs or GPT Builder |
93 | | -- Combine this embodiment with LLM or ChatBot deployment to serve multiple access channels |
| 88 | +<Spacer size="md" /> |
94 | 89 |
|
95 | | -Want to make it conversational? Learn how to [Deploy as ChatBot](/docs/agent-deployments/deployments/deploy-as-chatbot) and embed the same logic into your site’s UI. |
| 90 | +## What's Next? |
96 | 91 |
|
97 | | -<Spacer size="md" /> |
| 92 | +* [Build workflows in SmythOS](/docs/agent-studio/build-agents/building-workflows) |
| 93 | +* [Use chatbot with ChatGPT](/docs/agent-deployments/deployments/deploy-as-chatgpt) |
| 94 | +* [Expose your agent as an API](/docs/agent-deployments/deployments/deploy-as-api) |
0 commit comments