Projects
A project is a tenant in NotificationHub — it owns its own API key/secret pair, its own provider configuration, templates, and notification history. Project operations live under client.projects().
Project status
A project's status is one of:
| Status | Meaning |
|---|---|
ACTIVE | Normal operation. |
SUSPENDED | Temporarily disabled — reversible via updateStatus. |
DISABLED | Disabled. |
Create a project
Creating a project is the only call that returns the project's rawSecret — save it immediately, since it isn't retrievable afterward except by rotating it.
- Java
- Node.js
var credentials = client.projects().create("Acme Production");
System.out.println(credentials.apiKey());
System.out.println(credentials.rawSecret()); // store this securely — shown once
const credentials = await client.projects().create('Acme Production');
console.log(credentials.apiKey);
console.log(credentials.rawSecret); // store this securely — shown once
Get and list projects
- Java
- Node.js
var project = client.projects().get(projectId);
var page = client.projects().list(0, 20); // page, size
System.out.println(page.totalElements());
const project = await client.projects().get(projectId);
const page = await client.projects().list(0, 20); // page, size
console.log(page.totalElements);
list is paginated, mirroring standard page/size semantics, and returns content, totalPages, and totalElements.
Update status
- Java
- Node.js
client.projects().updateStatus(projectId, ProjectStatus.SUSPENDED);
await client.projects().updateStatus(projectId, ProjectStatus.SUSPENDED);
Rename a project
- Java
- Node.js
client.projects().updateName(projectId, "Acme Production (EU)");
await client.projects().updateName(projectId, 'Acme Production (EU)');
Rotate credentials
Rotating invalidates the previous key or secret immediately, so plan for a brief cutover when rotating a project that's live in production.
- Java
- Node.js
var newCredentials = client.projects().rotateSecret(projectId);
var newKey = client.projects().rotateApiKey(projectId);
const newCredentials = await client.projects().rotateSecret(projectId);
const newKey = await client.projects().rotateApiKey(projectId);
Delete a project
- Java
- Node.js
client.projects().delete(projectId);
await client.projects().delete(projectId);
Deletion is permanent. Consider updateStatus(projectId, ProjectStatus.SUSPENDED) first if you might need the project again.