> To find and run AgentRouter tools, connect to https://mcp.agentrouter.to/. To search this documentation, use https://docs.agentrouter.to/_mcp/server. Append .md to a page URL for Markdown. For the documentation index, see https://docs.agentrouter.to/llms.txt.

# Get a top-up

GET https://api.agentrouter.to/v1/wallet/topups/{topup_id}

Reference: https://docs.agentrouter.to/api-reference/agent-router-api/wallet/get-topup

## Authentication

- `Authorization` header (bearer token, required) — An AgentRouter API key or an OAuth access token issued to an MCP host or the CLI.

## Request

### Path parameters

- `topup_id` (string, required)

## Response

### 200

The top-up

- `topup_id` (string, required)
- `status` (enum, required)
  - Allowed values: `pending`, `completed`, `expired`, `failed`
- `amount_usd` (string, required) — Exact USD amount as a decimal string.
- `fee_usd` (string, required) — Exact USD amount as a decimal string.
- `total_usd` (string, required) — Exact USD amount as a decimal string.
- `created_at` (string, required)
- `completed_at` (string, required, nullable)

## Errors

### 404 Not Found Error

Not found for this account (TOOL_NOT_FOUND, RUN_NOT_FOUND, NO_RESULT, ...)

- `error` (ErrorError, required)
- `run` (Run, optional) — The receipt for one invocation. Run status, provider outcome and billing are separate facts.

## Types

### ErrorError

- `code` (string, required)
- `message` (string, required)
- `hints` (list of Hint, required)
- `details` (map from string to any, required)

### Run

The receipt for one invocation. Run status, provider outcome and billing are separate facts.

- `object` (any, required)
- `run_id` (string, required)
- `status` (enum, required)
  - Allowed values: `READY`, `RUNNING`, `STOPPING`, `COMPLETED`, `FAILED`, `BLOCKED`, `STOPPED`, `TIMED_OUT`
- `tool_id` (string, required)
- `tool_version` (string, required)
- `provider` (string, required)
- `input` (any, required) — The submitted tool input
- `session_id` (string, required, nullable)
- `caller` (RunCaller, required)
- `channel` (enum, required)
  - Allowed values: `http`, `cli`, `mcp`, `web`
- `created_at` (string, required, nullable)
- `started_at` (string, required, nullable)
- `completed_at` (string, required, nullable)
- `latency_ms` (integer, required, nullable)
- `replayed` (boolean, required) — True when an idempotency key returned an existing run.
- `stoppable` (boolean, required)
- `provider_response` (RunProviderResponse, required)
- `error` (RunError, required, nullable)
- `billing` (RunBilling, required)
- `result` (RunResult, required)
- `next_cursor` (string, required, nullable) — Pass back as the tool's cursor input for the next page (a new billed call).
- `hints` (list of Hint, required)
- `output` (any, required) — The provider's output exactly as returned

### Hint

- `code` (string, required) — Machine-readable next step, e.g. POLL_RUN, DESCRIBE_TOOL, TOP_UP, NEXT_PAGE.
- `message` (string, required)
- `params` (map from string to any, optional)

### RunCaller

- `type` (enum, required)
  - Allowed values: `api_key`, `oauth`, `session`
- `name` (string, required)

### RunProviderResponse

- `http_status` (integer, required, nullable)
- `outcome` (enum, required)
  - Allowed values: `success`, `empty`, `provider_error`, `pending`
- `status` (string, required, nullable)
- `request_id` (string, required, nullable)
- `task_id` (string, required, nullable)

### RunError

- `code` (string, required)
- `message` (string, required)
- `origin` (enum, required)
  - Allowed values: `provider`, `platform`, `client`
- `retryable` (boolean, required, nullable)
- `details` (RunErrorDetails, optional, nullable) — Sanitized provider error evidence. Absent for old runs and errors without an upstream response.

### RunBilling

- `status` (enum, required)
  - Allowed values: `none`, `reserved`, `settled`, `refunded_partial`, `refunded_full`
- `reason` (enum, required) — Why the charge is what it is. A zero charge always carries a reason.
  - Allowed values: `charged`, `charged_capped`, `free_promotion`, `zero_base`, `waived_provider_error`, `waived_platform_error`, `waived_empty_result`, `waived_stopped`, `waived_timeout`, `waived_unknown_cost`, `blocked_before_execution`
- `currency` (any, required)
- `pricing_version` (string, required)
- `price_multiplier` (string, required, nullable)
- `promotion_id` (string, required, nullable)
- `max_cost_usd` (string, required) — Exact USD amount as a decimal string.
- `reserved_usd` (string, required) — Exact USD amount as a decimal string.
- `base_charge_usd` (string, required, nullable) — Price before the multiplier.
- `customer_charge_usd` (string, required) — Exact USD amount as a decimal string.
- `customer_refund_usd` (string, required) — Exact USD amount as a decimal string.
- `net_charge_usd` (string, required) — Exact USD amount as a decimal string.
- `charge_is_new` (boolean, required) — False on an idempotent replay; nothing new was charged.
- `usage` (RunBillingUsage, required, nullable)

### RunResult

- `available` (boolean, required)
- `expired` (boolean, required) — True when a previously stored result has expired or is no longer present.
- `bytes` (integer, required, nullable)
- `expires_at` (string, required, nullable)
- `url` (string, required, nullable) — GET this to download the stored output; it never re-runs the tool.
- `inline` (boolean, required) — False when the output is too large to include; download it from url.

### RunErrorDetails

Sanitized provider error evidence. Absent for old runs and errors without an upstream response.

- `body` (string, required) — Provider response JSON text with credentials and internal pricing fields redacted; non-JSON bodies are omitted. Limited to 20000 characters.
- `truncated` (boolean, required) — True when only a prefix of the sanitized error was retained.

### RunBillingUsage

- `unit` (string, required)
- `quantity` (string, required, nullable)
- `status` (enum, required)
  - Allowed values: `known`, `none`, `unknown`

## Examples

**Response**

```json
{
  "topup_id": "string",
  "status": "pending",
  "amount_usd": "0.0035",
  "fee_usd": "0.0035",
  "total_usd": "0.0035",
  "created_at": "string",
  "completed_at": "string"
}
```

**SDK Code**

```python
import requests

url = "https://api.agentrouter.to/v1/wallet/topups/topup_id"

headers = {"Authorization": "Bearer <token>"}

response = requests.get(url, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.agentrouter.to/v1/wallet/topups/topup_id';
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://api.agentrouter.to/v1/wallet/topups/topup_id"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("Authorization", "Bearer <token>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.agentrouter.to/v1/wallet/topups/topup_id")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://api.agentrouter.to/v1/wallet/topups/topup_id")
  .header("Authorization", "Bearer <token>")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.agentrouter.to/v1/wallet/topups/topup_id', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.agentrouter.to/v1/wallet/topups/topup_id");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["Authorization": "Bearer <token>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.agentrouter.to/v1/wallet/topups/topup_id")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```