API Authentication
Learn how to authenticate with the Nexlayer API using session tokens. Base URL, token lifecycle, content types, and usage examples.
Base URL
All API requests should be made to:
Session Tokens
Nexlayer uses session tokens for API authentication. When you start a deployment, you receive a sessionToken that identifies your session and grants access to manage your deployments.
Important: Save your session token securely. You'll need it for all subsequent API calls to manage your deployment.
Obtaining a Session Token
Session tokens are automatically generated when you create a new deployment using the /startUserDeployment endpoint.
{
"message": "Deployment started successfully",
"url": "https://jolly-tapir-my-app.alpha.nexlayer.ai",
"sessionToken": "dCf0NdAQ64j6",
"applicationName": "my-app",
"environment": "jolly-tapir"
}Using Session Tokens
Include your session token in API requests either as a query parameter or in the request body, depending on the endpoint.
GET /getReservations?sessionToken=dCf0NdAQ64j6POST /extendDeployment
Content-Type: application/json
{
"sessionToken": "dCf0NdAQ64j6",
"applicationName": "my-app"
}Token Lifecycle
Session tokens remain valid as long as you have active deployments or reservations. Once all your deployments are removed or expired, you'll need to start a new deployment to get a fresh token.
Content Types
The Nexlayer API uses different content types depending on the endpoint:
| Content Type | Usage |
|---|---|
text/x-yaml | For deployment endpoints that accept YAML files |
application/json | For most other endpoints |