# Endpoints

Explore all available Polylith API endpoints to manage workflows, agents, and integrations seamlessly.

Polylith offers a variety of endpoints to interact with workflows, agents, and integrations. This guide provides an overview of all key endpoints, their usage, and example requests.

***

**1. Base URL**

All API requests start with the following base URL:

Copy

Copy

```
plaintextCopy codehttps://api.polylith.dev/v1/
```

Make sure to include your Polylith **API Key** in the request headers:

Copy

Copy

```
httpCopy codeAuthorization: Bearer YOUR_POLYLITH_API_KEY
```

***

**2. Endpoints Overview**

**Endpoint**

**Method**

**Description**

`/workflows`

POST

Create a new AI workflow.

`/workflows/{id}`

GET

Retrieve details of a specific workflow.

`/agents`

POST

Deploy a new AI agent.

`/agents/{id}`

GET

Get details of a deployed agent.

`/integrations`

GET

List all supported integrations.

`/vector-stores`

GET

Retrieve supported vector stores.

***

**3. Endpoint Details and Examples**

**1. Create a Workflow**

**Endpoint:**

Copy

Copy

```
httpCopy codePOST /workflows
```

**Request Example:**

Copy

Copy

```
jsonCopy code{
  "name": "telegram-chatbot",
  "input": {
    "platform": "telegram",
    "parameters": {
      "token": "YOUR_TELEGRAM_BOT_TOKEN"
    }
  },
  "processing": {
    "provider": "openai",
    "model": "gpt-4",
    "api_key": "YOUR_OPENAI_KEY",
    "prompt": "Summarize this text."
  },
  "output": {
    "platform": "telegram"
  }
}
```

**Response Example:**

Copy

Copy

```
jsonCopy code{
  "id": "wf_123456",
  "status": "created",
  "name": "telegram-chatbot",
  "created_at": "2024-06-18T12:00:00Z"
}
```

***

**2. Get Workflow Details**

**Endpoint:**

Copy

Copy

```
httpCopy codeGET /workflows/{id}
```

**Request Example:**

Copy

Copy

```
httpCopy codeGET /workflows/wf_123456
Authorization: Bearer YOUR_POLYLITH_API_KEY
```

**Response Example:**

Copy

Copy

```
jsonCopy code{
  "id": "wf_123456",
  "name": "telegram-chatbot",
  "status": "active",
  "created_at": "2024-06-18T12:00:00Z",
  "steps": [
    {"input": "telegram"},
    {"processing": "openai"},
    {"output": "telegram"}
  ]
}
```

***

**3. Deploy an AI Agent**

**Endpoint:**

Copy

Copy

```
httpCopy codePOST /agents
```

**Request Example:**

Copy

Copy

```
jsonCopy code{
  "workflow_id": "wf_123456",
  "parameters": {
    "auto_restart": true
  }
}
```

**Response Example:**

Copy

Copy

```
jsonCopy code{
  "id": "agent_789xyz",
  "status": "running",
  "workflow_id": "wf_123456",
  "created_at": "2024-06-18T12:05:00Z"
}
```

***

**4. Get Agent Details**

**Endpoint:**

Copy

Copy

```
httpCopy codeGET /agents/{id}
```

**Request Example:**

Copy

Copy

```
httpCopy codeGET /agents/agent_789xyz
Authorization: Bearer YOUR_POLYLITH_API_KEY
```

**Response Example:**

Copy

Copy

```
jsonCopy code{
  "id": "agent_789xyz",
  "status": "running",
  "workflow_id": "wf_123456",
  "uptime": "12 hours 45 minutes"
}
```

***

**5. List All Integrations**

**Endpoint:**

Copy

Copy

```
httpCopy codeGET /integrations
```

**Request Example:**

Copy

Copy

```
httpCopy codeGET /integrations
Authorization: Bearer YOUR_WAVE
BLOCK_API_KEY
```

**Response Example:**

Copy

Copy

```
jsonCopy code{
  "integrations": [
    {"provider": "openai", "models": ["gpt-3.5", "gpt-4"]},
    {"provider": "claude", "models": ["claude-2"]},
    {"provider": "gemini", "models": ["gemini-1"]},
    {"provider": "perplexity", "services": ["search"]},
    {"provider": "custom-api", "support": true}
  ]
}
```

***

**6. Retrieve Supported Vector Stores**

**Endpoint:**

Copy

Copy

```
httpCopy codeGET /vector-stores
```

**Request Example:**

Copy

Copy

```
httpCopy codeGET /vector-stores
Authorization: Bearer YOUR_POLYLITH_API_KEY
```

**Response Example:**

Copy

Copy

```
jsonCopy code{
  "vector_stores": [
    "Pinecone",
    "MongoDB Atlas",
    "LanceDB",
    "Neo4j"
  ]
}
```

***

**4. Error Responses**

API responses include standardized error codes for troubleshooting:

**Code**

**Message**

**Description**

`400`

Bad Request

Invalid request data.

`401`

Unauthorized

Missing or invalid API key.

`404`

Not Found

Resource does not exist.

`429`

Too Many Requests

Rate limit exceeded.

`500`

Internal Server Error

Something went wrong on our end.

***

**Conclusion**

Polylith provides a robust set of endpoints to create workflows, deploy agents, and integrate with AI models and vector stores. Use these APIs to build scalable AI solutions with ease.

For additional resources and advanced examples, explore the full **API Reference** section.


---

# Agent Instructions: 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:

```
GET https://polylith-ai.gitbook.io/docs/api-references/endpoints.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
