Official Node.js SDK for the Nitrozen.io changelog API.
npm install nitrozenioconst{ ApiClient, ProjectsApi, EntriesApi }=require('nitrozenio');// Create a client with your API tokenconstclient=ApiClient.create('YOUR_API_TOKEN');// List your projectsconstprojects=newProjectsApi(client);const{ data }=awaitprojects.projectsGet();console.log(data);// Project[]// Create a changelog entryconstentries=newEntriesApi(client);const{data: entry}=awaitentries.projectsProjectEntriesPost(data[0].id,{title: 'New feature',content: 'We shipped something great.',category: 'new'});console.log(entry);Create an API token on your API Tokens page.
Pass it to ApiClient.create() to get a ready-to-use client:
const{ ApiClient }=require('nitrozenio');constclient=ApiClient.create('YOUR_API_TOKEN');You can also rotate tokens dynamically by passing a function:
constclient=ApiClient.create(()=>getTokenFromVault());All methods return Promises. API errors reject with a NitrozenError that carries the HTTP status code and validation details:
const{ ApiClient, ProjectsApi, NitrozenError }=require('nitrozenio');constclient=ApiClient.create('YOUR_API_TOKEN');constprojects=newProjectsApi(client);try{const{ data }=awaitprojects.projectsProjectGet(999);}catch(err){if(errinstanceofNitrozenError){console.error(err.statusCode);// e.g. 404console.error(err.message);// e.g. "Not found"console.error(err.errors);// validation errors map, if any}}If you prefer callbacks, pass one as the last argument and the method returns void instead of a Promise:
constprojects=newProjectsApi(client);projects.projectsGet(function(error,data){if(error)throwerror;console.log(data);});Published entries for a project are available without authentication:
const{ ApiClient, PublicApi }=require('nitrozenio');constapi=newPublicApi(newApiClient());const{data: entries}=awaitapi.publicProjectsSlugEntriesGet('your-project-slug');console.log(entries);API rate limits are determined by your plan. When the limit is exceeded the API returns 429 Too Many Requests. Unauthenticated requests are limited to 60 requests per minute per IP address.
List endpoints accept page and perPage options and return a meta object with pagination details:
const{data: entries, meta }=awaitentriesApi.projectsProjectEntriesGet(projectId,{page: 2,perPage: 20});console.log(meta.total,meta.last_page);All URIs are relative to https://nitrozen.io/api/v1.
| Method | HTTP | Description |
|---|---|---|
tokensGet() | GET /tokens | List API tokens |
tokensPost(body) | POST /tokens | Create an API token |
tokensTokenDelete(id) | DELETE /tokens/{token} | Revoke an API token |
| Method | HTTP | Description |
|---|---|---|
projectsGet() | GET /projects | List projects |
projectsPost(body) | POST /projects | Create a project |
projectsProjectGet(id) | GET /projects/{project} | Get a project |
projectsProjectPut(id, body) | PUT /projects/{project} | Update a project |
projectsProjectDelete(id) | DELETE /projects/{project} | Delete a project |
| Method | HTTP | Description |
|---|---|---|
projectsProjectEntriesGet(id, opts?) | GET /projects/{project}/entries | List entries |
projectsProjectEntriesPost(id, body) | POST /projects/{project}/entries | Create an entry |
projectsProjectEntriesEntryGet(pid, eid) | GET /projects/{project}/entries/{entry} | Get an entry |
projectsProjectEntriesEntryPut(pid, eid, body) | PUT /projects/{project}/entries/{entry} | Update an entry |
projectsProjectEntriesEntryDelete(pid, eid) | DELETE /projects/{project}/entries/{entry} | Delete an entry |
| Method | HTTP | Description |
|---|---|---|
userGet() | GET /user | Get current user |
userUsageGet() | GET /user/usage | Get usage statistics |
| Method | HTTP | Description |
|---|---|---|
publicProjectsSlugEntriesGet(slug) | GET /public/projects/{slug}/entries | List published entries (no auth) |
Valid values for the category field: new · improvement · fix · announcement