Skip to content

Authentication Guide

The Market VPSBot API uses API Key authentication. Include your API key in the x-api-key header with every request.

Using Your API Key

HeaderValueDescription
x-api-key<your_api_key>Your API key

Managing API Keys

Create an API Key

http
POST /api/auth/api-keys
Content-Type: application/json
x-api-key: YOUR_EXISTING_API_KEY

{
  "name": "my-bot-key"
}

Response:

json
{
  "success": true,
  "data": {
    "name": "my-bot-key",
    "api_key": "vpsbot_xxxxxxxxxxxxxxxxxxxx",
    "created_at": "2024-01-15T10:00:00.000Z"
  }
}

WARNING

Save your API key immediately after creation. It will not be shown again.

List API Keys

http
GET /api/auth/api-keys

Response:

json
{
  "success": true,
  "data": [
    {
      "name": "my-bot-key",
      "created_at": "2024-01-15T10:00:00.000Z",
      "last_used_at": "2024-01-16T08:30:00.000Z"
    }
  ]
}

Delete an API Key

http
DELETE /api/auth/api-keys
Content-Type: application/json

{
  "name": "my-bot-key"
}

Get Current User

http
GET /api/auth/me

Response:

json
{
  "success": true,
  "data": {
    "id": "uuid",
    "login": "your_username",
    "first_name": "John",
    "last_name": "Doe",
    "avatar": null,
    "role": "project"
  }
}

Code Examples

js
const axios = require('axios');

const client = axios.create({
  baseURL: 'https://market.vpsbot.io/api',
  headers: {
    'x-api-key': 'YOUR_API_KEY'
  }
});

const response = await client.get('/items');
console.log(response.data);
bash
curl -X GET "https://market.vpsbot.io/api/items" \
  -H "x-api-key: YOUR_API_KEY"

Access Control

Only users with the project role can access the API.

Need help? Contact our support team