# API Reference

#### Authentication <a href="#authentication" id="authentication"></a>

All ContextBridge APIs require authentication via API key:

```http
x-api-key: YOUR_API_KEY_HERE
```

#### Base URLs & Endpoints <a href="#base-urls--endpoints" id="base-urls--endpoints"></a>

**Production Environment**

* **Base URL**: `https://backend.contextbridge.xyz`
* **MCP Servers**: `https://backend.contextbridge.xyz/mcp/{server-name}`

#### Response Format <a href="#response-format" id="response-format"></a>

**Success Response**

```json
{
  "success": true,
  "data": {
    // Response data here
  },
  "metadata": {
    "timestamp": "2024-01-15T10:30:00Z",
    "credits_used": 10,
    "remaining_credits": 990
  }
}
```

**Error Response**

```json
{
  "success": false,
  "error": {
    "code": "INSUFFICIENT_CREDITS",
    "message": "Not enough credits to complete request",
    "details": {
      "required": 50,
      "available": 25
    }
  }
}
```

#### Error Handling <a href="#error-handling" id="error-handling"></a>

**HTTP Status Codes**

* **200 OK**: Request successful
* **400 Bad Request**: Invalid request parameters
* **401 Unauthorized**: Invalid or missing API key
* **403 Forbidden**: Insufficient permissions
* **429 Too Many Requests**: Rate limit exceeded
* **402 Payment Required**: Insufficient credits
* **500 Internal Server Error**: Server error


---

# 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://contextbridge.gitbook.io/context-bridge/getting-started/api-reference.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.
