# How To Use Sniperoo API

This guide provides step-by-step instructions for common operations with the Sniperoo API.

## Prerequisites

Before you begin, you'll need:

1. A Sniperoo account
2. An API token (generate one in the "API Access" section of [Sniperoo platform](https://sniperoo.app/dashboard/api-access))
3. At least one Solana wallet with SOL


## Authentication

All API requests require the following header:


```
Authorization: Bearer YOUR_API_TOKEN
```

Replace `YOUR_API_TOKEN` with your actual API token.

## Auto-Sell Strategies

### Simple Auto-Sell


```json
{
  "enabled": true,
  "strategy": {
    "strategyName": "simple",
    "profitPercentage": 50,
    "stopLossPercentage": 20
  }
}
```

### Grid Strategy with Static Stop-Loss


```json
{
  "enabled": true,
  "strategy": {
    "strategyName": "grid",
    "stopLossType": "static",
    "stopLossPercentage": 15,
    "profitTargets": [
      {
        "multiplier": 1.5,
        "sellPercentage": 25
      },
      {
        "multiplier": 2.0,
        "sellPercentage": 50
      },
      {
        "multiplier": 3.0,
        "sellPercentage": 100
      }
    ]
  }
}
```

### Grid Strategy with Trailing Stop-Loss


```json
{
  "enabled": true,
  "strategy": {
    "strategyName": "grid",
    "stopLossType": "trailing",
    "stopLossPercentage": 10,
    "profitTargets": [
      {
        "multiplier": 1.5,
        "sellPercentage": 25,
        "trailingStopLossAfter": 20
      },
      {
        "multiplier": 2.0,
        "sellPercentage": 50,
        "trailingStopLossAfter": 30
      },
      {
        "multiplier": 3.0,
        "sellPercentage": 100,
        "trailingStopLossAfter": 40
      }
    ]
  }
}
```

## Error Handling

The API returns standard HTTP status codes:

- `2xx` - Success
- `4xx` - Client errors (invalid input, authentication issues)
- `5xx` - Server errors


Error responses include descriptive messages to help troubleshoot issues.

## Rate Limiting

The API implements rate limiting to ensure fair usage. If you exceed the limits, you'll receive a `429 Too Many Requests` response. Implement exponential backoff in your applications to handle these cases gracefully.