> For the complete documentation index, see [llms.txt](https://docs.pandaboost.app/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.pandaboost.app/api-for-developers/api-methods-reference.md).

# API Methods Reference

Authentication, targets, orders, status tracking, and error handling for PandaBoost API v1.

## Authentication

Send the API key in the `x-api-key` header.

```bash
curl -H "x-api-key: REPLACE_ME" \
  https://web.pandaboost.app/api/v1/balance
```

## Base URL

```
https://web.pandaboost.app/api/v1
```

## Response envelope

```json
{
  "success": true,
  "data": {}
}
```

```json
{
  "success": false,
  "error": "Error message"
}
```

## Order lifecycle

| Status       | Meaning                                                |
| ------------ | ------------------------------------------------------ |
| `pending`    | Accepted and queued for a manually fulfilled service   |
| `processing` | Dispatched to a worker                                 |
| `completed`  | Fulfilment completed                                   |
| `refunded`   | The charged amount was returned to the account balance |

A successful order creation can return either `processing` or `pending`. These are order statuses inside the JSON response; the corresponding HTTP transport code is `200`.

## GET /balance

Returns the current account balance.

```bash
curl -H "x-api-key: REPLACE_ME" \
  https://web.pandaboost.app/api/v1/balance
```

```json
{
  "success": true,
  "data": {
    "balance": "125.50000000",
    "currency": "USD"
  }
}
```

## GET /services

Returns active services, their order types, target requirements, limits, and the authenticated account's rates.

```bash
curl -H "x-api-key: REPLACE_ME" \
  https://web.pandaboost.app/api/v1/services
```

Call this endpoint before rendering a catalog or placing an order. Do not hard-code availability or rates.

## POST /targets/resolve

Resolves a token contract into the liquidity pairs supported by an order type. Pair-level services require one of the returned pair addresses when the order is created.

This authenticated lookup does not create an order or deduct the account balance. If the target cannot be resolved for the selected order type, handle the standard error envelope and do not submit an order with an unverified pair.

```bash
curl -X POST \
  -H "x-api-key: REPLACE_ME" \
  -H "Content-Type: application/json" \
  -d '{
    "orderTypeId": "dex-trending-sol-24h",
    "address": "<TOKEN_CONTRACT_ADDRESS>"
  }' \
  https://web.pandaboost.app/api/v1/targets/resolve
```

Example response shape:

```json
{
  "success": true,
  "data": {
    "requirement": {
      "pairSelection": "required"
    },
    "resolution": {
      "token": {
        "chainId": "solana",
        "address": "<TOKEN_CONTRACT_ADDRESS>",
        "symbol": "TOKEN"
      },
      "pairs": [
        {
          "dexId": "raydium",
          "pairAddress": "<SUPPORTED_PAIR_ADDRESS>",
          "liquidityUsd": 125000,
          "volume24hUsd": 84000
        }
      ]
    }
  }
}
```

{% hint style="warning" %}
A token contract and a liquidity-pair address are different targets. When `pairSelection` is `required`, submit a `pairAddress` returned for the selected order type.
{% endhint %}

## POST /orders

Creates an order and deducts the calculated amount from the account balance.

### Request body

| Field         | Type   | Description                                                                             |
| ------------- | ------ | --------------------------------------------------------------------------------------- |
| `serviceName` | string | Service name returned by `GET /services`                                                |
| `orderTypeId` | string | Order type ID returned by `GET /services`                                               |
| `quantity`    | number | Quantity within the order type's current minimum and maximum                            |
| `target`      | object | Optional token-first object with `address` and, when required, a selected `pairAddress` |
| `fields`      | object | Supported v1 fields and options such as `speed`                                         |

Use one source of truth for target addresses:

* **Legacy request:** omit `target` and send the published token or pair field inside `fields`.
* **Token-first request:** send the token and selected pair in `target`; use `fields` only for non-target options such as `speed`.
* Do not duplicate an address in both formats. The API does not define precedence for conflicting target values; treat a mixed or inconsistent request as invalid.

### Token-first format

```json
{
  "serviceName": "dex-trending",
  "orderTypeId": "dex-trending-sol-24h",
  "quantity": 1,
  "target": {
    "address": "<TOKEN_CONTRACT_ADDRESS>",
    "pairAddress": "<PAIR_SELECTED_FROM_TARGET_RESOLVER>"
  },
  "fields": {}
}
```

### Existing v1 fields format

Existing integrations can continue using their published field-based request shape.

```json
{
  "serviceName": "dex-trending",
  "orderTypeId": "dex-trending-evm-24h",
  "quantity": 1,
  "fields": {
    "pair_address": "<PAIR_ADDRESS>"
  }
}
```

### Successful response

```json
{
  "success": true,
  "data": {
    "order": {
      "publicId": "ABCD1234",
      "status": "processing"
    },
    "payment": {
      "ref": "PAY-EXAMPLE",
      "amount": 12.5
    },
    "newBalance": "112.50000000"
  }
}
```

### Order creation outcomes

* HTTP `200` with `order.status: processing`: dispatched to a worker. Persist `publicId` and poll the order.
* HTTP `200` with `order.status: pending`: queued for a manually fulfilled service. Persist `publicId` and poll the order.
* HTTP `400` without `refunded: true`: request validation, target, or balance error. Correct the request before trying again.
* HTTP `400` with `refunded: true`: dispatch failed and the charged amount was returned automatically. Treat that creation attempt as terminal and do not retry it automatically.
* HTTP `202` with `underReview: true` and `paymentRef`: automatic dispatch and automatic refund could not be completed. Retain the reference, check order status, and contact support if needed; do not submit a duplicate order.

HTTP `400` validation or balance error:

```json
{
  "success": false,
  "error": "Error message"
}
```

HTTP `400` failed dispatch with automatic refund:

```json
{
  "success": false,
  "error": "Order failed",
  "refunded": true
}
```

HTTP `202` accepted for operator review:

```json
{
  "underReview": true,
  "paymentRef": "<PAYMENT_REFERENCE>"
}
```

{% hint style="warning" %}
`POST /orders` deducts balance immediately and is not documented as idempotent. On a timeout or ambiguous response, check the order list and account balance before sending another creation request.
{% endhint %}

## GET /orders

Lists account orders with pagination.

| Query parameter | Default | Description                                         |
| --------------- | ------- | --------------------------------------------------- |
| `page`          | `1`     | Page number                                         |
| `limit`         | `20`    | Items per page, maximum `100`                       |
| `status`        | all     | `pending`, `processing`, `completed`, or `refunded` |

```bash
curl -H "x-api-key: REPLACE_ME" \
  "https://web.pandaboost.app/api/v1/orders?page=1&limit=10"
```

## GET /orders/:id

Returns detailed status for a single order that belongs to the authenticated account.

```bash
curl -H "x-api-key: REPLACE_ME" \
  https://web.pandaboost.app/api/v1/orders/ABCD1234
```

## HTTP responses

| HTTP status | Meaning                                                                       |
| ----------- | ----------------------------------------------------------------------------- |
| `200`       | Request completed successfully                                                |
| `202`       | Accepted for operator review; inspect `underReview` and retain `paymentRef`   |
| `400`       | Invalid request, insufficient balance, or failed dispatch; inspect `refunded` |
| `401`       | Missing or invalid API key                                                    |
| `403`       | API access is not enabled for the account                                     |
| `404`       | Resource does not exist or does not belong to the account                     |
| `500`       | Internal server error                                                         |

See Service Payload Examples for current request shapes.
