The AfterAds REST API spans 4 surfaces: Tracking, Studio, Loyalty, Services.
#Base URLs
| Environment | Base URL | Notes |
|---|---|---|
| Production | https://afterads.com/api | Default |
| Staging | https://staging.afterads.com/api | For testing |
| Local | http://localhost:3000/api | Development only |
#Authentication
#Core endpoints
| Endpoint | Method | Description |
|---|---|---|
/api/track | POST | Salla theme event (HMAC-signed) |
/api/studio/rewrite | POST | AI product description rewrite (SSE) |
/api/waitlist | POST | Subscribe an email to a waitlist |
/api/orders | GET | Current user's orders |
/api/services | POST | Create a service request |
/api/services/:id | GET, PATCH | View / update a request |
/api/auth/* | * | Better Auth endpoints |
/api/health | GET | Health check |
/api/webhooks/moyasar | POST | Moyasar payment webhook |
#Rate limits
#Error format
All errors return a unified JSON shape:
{
"error": "rate_limited",
"message": "Daily rewrite quota exceeded",
"retry_after_seconds": 3600
}#HTTP codes
| Code | Use |
|---|---|
| 200 | Success + body |
| 204 | Success without body (e.g. OPTIONS) |
| 400 | invalid_request (Zod validation) |
| 401 | unauthenticated or bad signature |
| 403 | forbidden (not admin, etc.) |
| 404 | resource not found |
| 409 | conflict (duplicate slug, etc.) |
| 429 | rate_limited |
| 500 | internal server error |
#Versioning
#Idempotency
Some endpoints accept an Idempotency-Key header (16-char string):
POST /api/orders— useful for network timeoutsPOST /api/services— same benefit