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

# Overview

The Cashramp Bot API is a GraphQL API for agents — it lets you programmatically access your agent profile, balances, rates, and account settings, and manage P2P payments on behalf of your bot.

## Endpoint

| Environment    | URL                                              |
| -------------- | ------------------------------------------------ |
| **Production** | `https://api.useaccrue.com/cashramp/bot/graphql` |

## Authentication

All requests require an **agent API key** passed as a Bearer token:

```
Authorization: Bearer {api_key}
```

### Example

{% hint style="info" %}
First-party SDKs do not yet cover the Bot API. Use the raw-HTTP examples below until the Bot SDK ships.
{% endhint %}

{% tabs %}
{% tab title="Node (axios)" %}

```javascript
import axios from "axios";

const cashrampBot = axios.create({
  baseURL: "https://api.useaccrue.com/cashramp/bot/graphql",
  headers: {
    Authorization: `Bearer ${process.env.AGENT_API_KEY}`,
  },
});
```

{% endtab %}

{% tab title="Python (requests)" %}

```python
import os
import requests

CASHRAMP_BOT_URL = "https://api.useaccrue.com/cashramp/bot/graphql"

cashramp_bot = requests.Session()
cashramp_bot.headers.update({
    "Authorization": f"Bearer {os.environ['AGENT_API_KEY']}",
    "Content-Type": "application/json",
})
```

{% endtab %}

{% tab title="Ruby (net/http)" %}

```ruby
require "net/http"
require "uri"
require "json"

CASHRAMP_BOT_URL = URI("https://api.useaccrue.com/cashramp/bot/graphql")

def cashramp_bot_request(query, variables = {})
  http = Net::HTTP.new(CASHRAMP_BOT_URL.host, CASHRAMP_BOT_URL.port)
  http.use_ssl = true
  req = Net::HTTP::Post.new(CASHRAMP_BOT_URL)
  req["Authorization"] = "Bearer #{ENV['AGENT_API_KEY']}"
  req["Content-Type"] = "application/json"
  req.body = { query: query, variables: variables }.to_json
  JSON.parse(http.request(req).body)
end
```

{% endtab %}

{% tab title="Go (net/http)" %}

```go
package main

import (
  "bytes"
  "encoding/json"
  "net/http"
  "os"
)

const cashrampBotURL = "https://api.useaccrue.com/cashramp/bot/graphql"

func cashrampBotRequest(query string, variables map[string]any) (*http.Response, error) {
  body, _ := json.Marshal(map[string]any{"query": query, "variables": variables})
  req, err := http.NewRequest("POST", cashrampBotURL, bytes.NewBuffer(body))
  if err != nil {
    return nil, err
  }
  req.Header.Set("Authorization", "Bearer "+os.Getenv("AGENT_API_KEY"))
  req.Header.Set("Content-Type", "application/json")
  return http.DefaultClient.Do(req)
}
```

{% endtab %}

{% tab title="cURL" %}

```bash
curl https://api.useaccrue.com/cashramp/bot/graphql \
  -H "Authorization: Bearer $AGENT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "query": "{ agent { id } }" }'
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
All requests must be over **HTTPS**. Calls without valid authentication are rejected.
{% endhint %}
