Skip to main content

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:

StatusMeaning
ACTIVENormal operation.
SUSPENDEDTemporarily disabled — reversible via updateStatus.
DISABLEDDisabled.

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.

var credentials = client.projects().create("Acme Production");

System.out.println(credentials.apiKey());
System.out.println(credentials.rawSecret()); // store this securely — shown once

Get and list projects

var project = client.projects().get(projectId);

var page = client.projects().list(0, 20); // page, size
System.out.println(page.totalElements());

list is paginated, mirroring standard page/size semantics, and returns content, totalPages, and totalElements.

Update status

client.projects().updateStatus(projectId, ProjectStatus.SUSPENDED);

Rename a project

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.

var newCredentials = client.projects().rotateSecret(projectId);
var newKey = client.projects().rotateApiKey(projectId);

Delete a project

client.projects().delete(projectId);

Deletion is permanent. Consider updateStatus(projectId, ProjectStatus.SUSPENDED) first if you might need the project again.