Skip to Content
Overview

Ngamia Music API

Create, manage, and share music with Ngamia

Ngamia Music is a web application backed by a session-aware NestJS API. This guide documents the API implemented in the Music API service: Camel Accounts OAuth exchange, secure session cookies, model discovery, long-running track generation, and an authenticated proxy to the Ngamia platform API.

What this service does

The Music API is a NestJS application running on the Express adapter. It exchanges a short-lived OAuth authorization code for Camel Accounts credentials, uses the Camel access token to establish a Ngamia account session, and keeps Ngamia access and refresh tokens in HttpOnly cookies. Authenticated calls go from the service to the Ngamia API with a per-account bearer token. The browser never receives that Ngamia token.

The service implements seven route shapes: health, Camel sign-in exchange, session inspection, logout, model catalog, music generation, and /api/ngamia/v1/* forwarding. The upstream proxy is a bridge to another API; it does not define that API’s resource schemas.

Choose a guide

GoalGuide
Run the services locallyGetting started
Understand code exchange and token refreshAuthentication & sessions
Send the correct browser origin and cookiesOrigins, cookies & CORS
Call a Music API routeAPI reference
Generate and retrieve audioGenerate a track
Configure productionConfiguration

Service endpoints at a glance

MethodPathSessionResult
GET/api/healthNoService status JSON
POST/api/auth/camelNoExchanges OAuth code; writes cookies
GET/api/auth/sessionYes (if present)Current profile, or {authenticated:false}
POST/api/auth/logoutOptionalRevokes upstream session when possible; clears cookies
GET/api/music/modelsYesAccount’s upstream model catalog
POST/api/music/generateYesAudio bytes for a generated track
Any method (proxied)/api/ngamia/v1/*UsuallyNgamia API passthrough

The route implementation is the source of truth. See scope and limitations for behaviors owned by the upstream Ngamia API and therefore not specified by this service.

Last updated on