StateSet API Reference
Welcome to the StateSet API. Our comprehensive REST and GraphQL APIs enable you to build powerful autonomous business applications that scale with your needs.API Version: v1 (Current)
SDK Versions: Node.js v3.2.0 | Python v2.1.0 | Go v1.4.0 | Ruby v2.0.0
Last Updated: January 2026
REST API
RESTful endpoints for all StateSet resources
GraphQL API
Flexible queries with real-time subscriptions
SDKs
Official SDKs for popular languages
Webhooks
Real-time event notifications
Production Environment:
- Base URL:
https://api.stateset.com/v1 - GraphQL:
https://api.stateset.com/graphql - WebSocket:
wss://api.stateset.com/v1/ws
- Base URL:
https://api.sandbox.stateset.com/v1 - GraphQL:
https://api.sandbox.stateset.com/graphql - WebSocket:
wss://api.sandbox.stateset.com/v1/ws
Quick Start
Get Your API Key
- Sign up at stateset.com
- Navigate to Settings → API Keys
- Generate a new API key with appropriate scopes
Authentication
StateSet API uses API key authentication with support for multiple authentication methods to suit different use cases.API Key Types
| Key Type | Prefix | Environment | Usage |
|---|---|---|---|
| Live Key | sk_live_ | Production | Real transactions and data |
| Test Key | sk_test_ | Sandbox | Development and testing |
| Restricted Key | rk_live_ | Production | Limited scope access |
| Publishable Key | pk_live_ | Client-side | Public operations only |
API Key Authentication
Environment Variables
We recommend storing your API keys as environment variables:Rate Limits
Rate Limits by Plan:
- Starter: 100 requests/minute, 10,000 requests/day
- Growth: 1,000 requests/minute, 100,000 requests/day
- Scale: 5,000 requests/minute, 500,000 requests/day
- Enterprise: Custom limits up to 10,000 requests/minute
X-RateLimit-Limit: Maximum requests allowed in current windowX-RateLimit-Remaining: Requests remaining in current windowX-RateLimit-Reset: Unix timestamp when limit resetsX-RateLimit-Retry-After: Seconds to wait before retrying (when limited)
Handling Rate Limits
When you exceed rate limits, you’ll receive a429 Too Many Requests response:
Error Handling
StateSet API uses conventional HTTP response codes and returns detailed error information in JSON format with consistent error structures.HTTP Status Codes
| Code | Meaning |
|---|---|
200 | OK - Request succeeded |
201 | Created - Resource created successfully |
400 | Bad Request - Invalid request parameters |
401 | Unauthorized - Invalid or missing API key |
403 | Forbidden - Insufficient permissions |
404 | Not Found - Resource doesn’t exist |
409 | Conflict - Resource already exists or constraint violation |
422 | Unprocessable Entity - Validation errors |
429 | Too Many Requests - Rate limit exceeded |
500 | Internal Server Error - Something went wrong on our end |
Error Response Format
Common Error Codes
Authentication Errors
Authentication Errors
INVALID_API_KEY: API key is invalid or expiredMISSING_API_KEY: No API key providedINSUFFICIENT_PERMISSIONS: API key doesn’t have required permissions
Validation Errors
Validation Errors
VALIDATION_ERROR: Request data failed validationMISSING_REQUIRED_FIELD: Required field not providedINVALID_FIELD_FORMAT: Field format is incorrect
Resource Errors
Resource Errors
RESOURCE_NOT_FOUND: Requested resource doesn’t existRESOURCE_ALREADY_EXISTS: Resource with same identifier existsRESOURCE_CONFLICT: Operation conflicts with current resource state
Pagination
List endpoints support both offset-based and cursor-based pagination. We recommend cursor-based pagination for better performance and consistency.Pagination Parameters
| Parameter | Type | Default | Max | Description |
|---|---|---|---|---|
limit | integer | 10 | 100 | Number of items per page |
cursor | string | null | - | Cursor for next page (recommended) |
offset | integer | 0 | 10000 | Number of items to skip |
page | integer | 1 | - | Page number (deprecated) |
Offset-Based Pagination
Cursor-Based Pagination (Recommended)
More efficient for large datasets and handles real-time data changes:Filtering and Sorting
Most list endpoints support powerful filtering and sorting capabilities using a consistent query syntax.Filter Operators
| Operator | Description | Example |
|---|---|---|
_eq | Equals | ?status_eq=shipped |
_ne | Not equals | ?status_ne=cancelled |
_gt | Greater than | ?amount_gt=100 |
_gte | Greater than or equal | ?amount_gte=100 |
_lt | Less than | ?amount_lt=500 |
_lte | Less than or equal | ?amount_lte=500 |
_in | In array | ?status_in=pending,processing |
_like | Pattern match | ?email_like=%@example.com |
_between | Range | ?created_between=2024-01-01,2024-01-31 |
Common Filter Patterns
Sorting
Official SDKs
Node.js
Python
Ruby
Go
SDK Quick Example
GraphQL API
StateSet offers a powerful GraphQL API for flexible data querying and real-time subscriptions.GraphQL Endpoint
Basic Query Example
Real-time Subscriptions
Webhooks
StateSet can send webhook notifications for important events in your account. Webhooks enable real-time integrations and automated workflows.Webhook Configuration
- Configure endpoints in Dashboard → Settings → Webhooks
- Select events to subscribe to
- Add webhook signing secret to verify authenticity
- Test with webhook simulator
Webhook Events
Order Events
Order Events
order.created- New order placedorder.updated- Order details modifiedorder.paid- Payment confirmedorder.processing- Order processing startedorder.shipped- Shipment createdorder.delivered- Delivery confirmedorder.cancelled- Order cancelledorder.refunded- Refund processed
Return Events
Return Events
return.created- Return initiatedreturn.approved- Return approvedreturn.received- Items receivedreturn.processed- Return completedreturn.rejected- Return rejected
Inventory Events
Inventory Events
inventory.low_stock- Stock below thresholdinventory.out_of_stock- Item out of stockinventory.updated- Stock levels changedinventory.transfer- Stock transferred
Customer Events
Customer Events
customer.created- New customer registeredcustomer.updated- Customer profile updatedcustomer.deleted- Customer deletedcustomer.subscription.created- Subscription startedcustomer.subscription.cancelled- Subscription cancelled
Webhook Payload Structure
Webhook Security & Verification
Testing
Sandbox Environment
The sandbox environment provides a complete testing environment that mirrors production:Test Data
- Test Cards
- Test Scenarios
- Webhook Testing
| Card Number | Scenario | Result |
|---|---|---|
4242 4242 4242 4242 | Successful payment | Always succeeds |
4000 0000 0000 0002 | Card declined | Always fails |
4000 0000 0000 9995 | Insufficient funds | Fails with insufficient_funds |
4000 0000 0000 0127 | Incorrect CVC | Fails CVC check |
Idempotency
StateSet API supports idempotency for safely retrying requests without side effects:Idempotency Keys:
- Valid for 24 hours after first request
- Must be unique per API key
- Recommended format:
{resource}-{uuid}(e.g.,order-550e8400-e29b-41d4-a716)
API Limits & Quotas
Request Limits by Plan
| Plan | Requests/Min | Requests/Day | Burst Limit | Concurrent Connections |
|---|---|---|---|---|
| Free | 60 | 1,000 | 100/sec | 10 |
| Starter | 100 | 10,000 | 200/sec | 25 |
| Growth | 1,000 | 100,000 | 1,000/sec | 100 |
| Scale | 5,000 | 500,000 | 5,000/sec | 500 |
| Enterprise | Custom | Unlimited | Custom | Unlimited |
Resource Limits
| Resource | Limit | Notes |
|---|---|---|
| Max request size | 10 MB | Increase available for Enterprise |
| Max response size | 50 MB | Paginate for larger datasets |
| Webhook timeout | 30 seconds | Retry up to 3 times |
| File upload size | 100 MB | Direct upload to S3 for larger files |
| Batch operations | 1,000 items | Use async jobs for larger batches |
Support and Community
API Support
Get help with integration issues
Discord Community
Join our developer community
Status Page
Check API status and uptime
Additional Resources
- API Changelog - Latest updates and changes
- Postman Collection - Ready-to-use API collection
- OpenAPI Specification - Machine-readable API spec
- Code Examples - Sample implementations
Ready to get started? Check out our 5-minute quickstart guide or explore the API reference sections below.