Skip to content

Using the REST API

The REST APIs that Solace Cloud documents, such as the Event Portal REST API, are served by the API gateway in your installation. Every request carries an API token that your installation issued.

Create an API Token

Create the token in the Cloud Console as described in Managing API Tokens. Give it only the permissions your client needs.

The token is a JSON Web Token (JWT). Keep it as you would a password: anyone who holds it can call the API with its permissions until you delete the token.

Send a Request

Send requests to your own hostname under /api, not to api.solace.cloud. Use your API hostname if you set one, or your console hostname. Pass the token in the Authorization header:

curl -H "Authorization: Bearer $TOKEN" \
  https://console.example.com/api/v2/architecture/applicationDomains

How Your Installation Signs Tokens

Each installation signs its API tokens with its own RSA private key, JWT_PRIVATE_KEY in the release's Secret. The chart generates the key when you install and keeps it across upgrades, or you supply your own; see Provide Secrets.

Because the key belongs to the installation:

  • A token works only on the installation that issued it. A token from Solace Cloud or from another installation is rejected.
  • Changing the key invalidates every API token. Create new tokens and update your clients afterwards.
  • A restored installation needs the same key. Keep the Secret with your backups, as described in Backup and Restore, or the tokens your clients hold stop working.

The API gateway refuses to start with the development keys built into its source code, so an installation never signs tokens with a key that is publicly known. If you manage the Secret yourself and leave out JWT_PRIVATE_KEY, the API gateway fails at startup.

If a Request Is Rejected

A 401 Unauthorized response means the API gateway did not accept the token. Check that:

  • The Authorization header reads Bearer followed by the token.
  • The token has not been deleted.
  • The token was created on this installation, and the key has not changed since.