Getting Started
Authenticate with the ZopNight API and make your first request — base URL, login flow, response envelope, pagination, and a sample resource listing call.
3 min read Last updated:
This guide walks you through authenticating with the ZopNight API and making your first request.
Prerequisites
- A ZopNight account with at least one organization
- At least one connected cloud account (AWS, GCP, or Azure)
- An API client or
curlfor making HTTP requests
Base URL
All API requests are made to the gateway endpoint:
https://zopnight.com/apiAuthentication
First, obtain an access token by logging in. ZopNight supports email/password, Google, GitHub, and SAML authentication.
Step 1: Login
curl -X POST https://zopnight.com/api/auth/login \ -H "Content-Type: application/json" \ -d '{ "email": "you@company.com", "password": "your-password", "provider": "email" }'{ "data": { "accessToken": "eyJhbGciOiJSUzI1NiIs...", "refreshToken": "dGhpcyBpcyBhIHJlZnJl...", "tenants": [ { "id": "org_abc123", "name": "My Organization" } ], "user": { "email": "you@company.com", "name": "Your Name" } }}Step 2: Use the Token
Include the access token in all subsequent requests via the Authorization header:
curl https://zopnight.com/api/resources \ -H "Authorization: Bearer eyJhbGciOiJSUzI1NiIs..."See the full Authentication guide for token refresh, SSO, and more.
Response Format
All API responses are wrapped in a standard envelope:
{ "data": { "id": "sch_abc123", "name": "Business Hours" }}{ "error": "schedule not found"}Pagination
List endpoints support pagination via query parameters:
| Parameter | Type | Description |
|---|---|---|
page | integer | Page number (default: 1) |
limit | integer | Items per page (default: 20) |
sort_by | string | Field to sort by |
sort_order | string | asc or desc |
curl "https://zopnight.com/api/resources?page=2&limit=50&sort_by=name&sort_order=asc" \ -H "Authorization: Bearer <token>"Your First API Call
Let’s list your discovered cloud resources:
curl https://zopnight.com/api/resources \ -H "Authorization: Bearer <token>"{ "data": [ { "id": "res_001", "name": "web-server-prod", "uid": "i-0abc123def456", "type": "aws-ec2", "provider": "aws", "region": "us-east-1", "status": "running", "instanceType": "t3.medium", "schedulable": true, "tags": { "Environment": "production" } } ]}