1st Services Logo
Getting Started

Authentication

Learn how to authenticate API requests and manage access tokens securely on 1st Services.

Authentication

All requests to the 1st Services REST API must be authenticated using an API key passed via the standard HTTP Authorization header.


Bearer Token Authentication

Include your API key as a Bearer token with every HTTP request:

HTTP Request
GET /v1/vps/instances HTTP/1.1
Host: api.1st-services.com
Authorization: Bearer fst_live_9a8b7c6d5e4f3a2b1c0d
Content-Type: application/json
cURL
curl -X GET "https://api.1st-services.com/v1/vps/instances" \
  -H "Authorization: Bearer $FIRST_API_KEY"

Token Types & Prefixes

1st Services issues keys with explicit environment prefixes to prevent accidental exposure of production credentials:

Key TypePrefixDescription
Live / Productionfst_live_Accesses production VPS, active databases, live short links, and real mailboxes.
Test / Sandboxfst_test_Operates against simulated staging resources without incurring billing charges.
Restricted Tokenfst_res_Scoped to a specific microservice (e.g. Temp Mail only or URL Shortener only).

Granular API Scopes

When creating an API key, you can restrict its permissions to only the capabilities required by your application:

ScopePermission Description
vps:readList instances, view specs, monitor CPU/RAM metrics
vps:writeCreate, reboot, rebuild, power-off, resize, delete VPS
database:readInspect database connection strings, cluster status
database:writeProvision databases, trigger backups, configure replicas
shortener:*Create, edit, delete, and view analytics for short links
tempmail:*Generate disposable mailboxes, fetch received messages
billing:readView invoices, usage metrics, and balance

Webhook Signature Verification

When receiving webhooks from 1st Services (such as incoming Temp Mail alerts or Database Backup notifications), verify the authenticity of the payload using the X-1st-Signature header.

Signatures use HMAC-SHA256 with your webhook secret:

TypeScript / Node.js
import crypto from 'node:crypto'

export function verifyWebhookSignature(payload: string, signatureHeader: string, secret: string): boolean {
  const expectedSignature = crypto
    .createHmac('sha256', secret)
    .update(payload)
    .digest('hex')
  
  return crypto.timingSafeEqual(
    Buffer.from(signatureHeader),
    Buffer.from(expectedSignature)
  )
}

Security Best Practices

Protect Your Production API Keys
Copyright © 2026