Skip to main content Skip to content

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 curl for making HTTP requests

Base URL

All API requests are made to the gateway endpoint:

Terminal window
https://zopnight.com/api

Authentication

First, obtain an access token by logging in. ZopNight supports email/password, Google, GitHub, and SAML authentication.

Step 1: Login

Request
curl -X POST https://zopnight.com/api/auth/login \
-H "Content-Type: application/json" \
-d '{
"email": "you@company.com",
"password": "your-password",
"provider": "email"
}'
Response
{
"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:

Authenticated request
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:

Success response
{
"data": {
"id": "sch_abc123",
"name": "Business Hours"
}
}
Error response
{
"error": "schedule not found"
}

Pagination

List endpoints support pagination via query parameters:

ParameterTypeDescription
pageintegerPage number (default: 1)
limitintegerItems per page (default: 20)
sort_bystringField to sort by
sort_orderstringasc or desc
Example
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:

List resources
curl https://zopnight.com/api/resources \
-H "Authorization: Bearer <token>"
Response
{
"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" }
}
]
}

Next Steps

Connect a Cloud Account

Add your AWS, GCP, or Azure credentials

Create a Schedule

Set up automated start/stop rules

Explore Resources

Filter and search your cloud inventory

Cloud Support Matrix

See supported resource types per provider

Multi-cloud automation· Production-ready in 30 min· SOC 2 · ISO 27001 · zero-trust· 30% average cloud cost cut· 4 platforms · 1 console· Multi-cloud automation· Production-ready in 30 min· SOC 2 · ISO 27001 · zero-trust· 30% average cloud cost cut· 4 platforms · 1 console·