> ## Documentation Index
> Fetch the complete documentation index at: https://docs.phonely.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Agent Websites

> List, add, and delete agent website knowledge sources through the frontend API.

Manages website URLs associated with an agent's knowledge base. This endpoint supports GET, POST, and DELETE operations.

### List Websites

**Method:** `GET`\
**Endpoint:** `/api/agent-websites`\
**Headers:**

* `X-Authorization`: Your API key (required)

**Query Parameters:**

* `uid` (string, required): Your user ID
* `agentId` (string, required): The ID of the agent

**Response:**

```json theme={null}
{
  "websites": [
    {
      "id": "string",
      "url": "string",
      "active": boolean,
      "lastUpdatedBy": "string",
      "lastUpdatedAt": "string"
    }
  ]
}
```

### Add Website

**Method:** `POST`\
**Endpoint:** `/api/agent-websites`\
**Headers:**

* `X-Authorization`: Your API key (required)
* `Content-Type`: `application/json`

**Request Body:**

```json theme={null}
{
  "uid": "string",
  "agentId": "string",
  "url": "string"
}
```

**Response:**

```json theme={null}
{
  "websiteId": "string",
  "message": "Website added successfully"
}
```

### Delete Website

**Method:** `DELETE`\
**Endpoint:** `/api/agent-websites`\
**Headers:**

* `X-Authorization`: Your API key (required)

**Query Parameters:**

* `uid` (string, required): Your user ID
* `agentId` (string, required): The ID of the agent
* `websiteId` (string, required): The ID of the website to delete

**Response:**

```json theme={null}
{
  "message": "Website deleted successfully"
}
```

### Error Responses

* `400 Bad Request`: Invalid request parameters or invalid URL
* `401 Unauthorized`: Invalid or missing API key, or insufficient permissions
* `404 Not Found`: Website not found (for DELETE operations)
* `500 Internal Server Error`: Server error

### Examples

**List websites:**

```bash theme={null}
curl -X GET "https://app.phonely.ai/api/agent-websites?uid=user123&agentId=agent456" \
  -H "X-Authorization: your-api-key"
```

**Add website:**

```bash theme={null}
curl -X POST https://app.phonely.ai/api/agent-websites \
  -H "X-Authorization: your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "uid": "user123",
    "agentId": "agent456",
    "url": "https://example.com"
  }'
```

**Delete website:**

```bash theme={null}
curl -X DELETE "https://app.phonely.ai/api/agent-websites?uid=user123&agentId=agent456&websiteId=web789" \
  -H "X-Authorization: your-api-key"
```


## OpenAPI

````yaml GET /agent-websites
openapi: 3.0.1
info:
  title: Phonely API
  description: API for Phonely services including agent management and call summaries
  version: 1.0.0
servers:
  - url: https://app.phonely.ai/api
security: []
paths:
  /agent-websites:
    get:
      summary: List agent websites
      description: Retrieve all websites associated with a specific agent's knowledge base
      parameters:
        - name: uid
          in: query
          required: true
          schema:
            type: string
          description: User ID
        - name: agentId
          in: query
          required: true
          schema:
            type: string
          description: Agent ID
      responses:
        '200':
          description: List of websites
          content:
            application/json:
              schema:
                type: object
                properties:
                  websites:
                    type: array
                    items:
                      $ref: '#/components/schemas/Website'
        '400':
          description: Invalid parameters
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - ApiKeyAuth: []
components:
  schemas:
    Website:
      type: object
      properties:
        id:
          type: string
          description: Website ID
        agentId:
          type: string
          description: Associated agent ID
        name:
          type: string
          description: Website name or title
        url:
          type: string
          format: uri
          description: Website URL
        active:
          type: boolean
          description: Website active status
        content:
          type: string
          description: Processed website content (JSON format)
        contentMD:
          type: string
          description: Website content in Markdown format
        lastUpdatedBy:
          type: string
          description: Who last updated the website
        lastUpdatedAt:
          type: string
          format: date-time
          description: When the website was last updated
    Error:
      type: object
      properties:
        error:
          type: string
          description: Error code or identifier
        message:
          type: string
          description: Detailed error message
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-Authorization

````