ChirpStack API Server

Hello,
We are using V4 docker image
Question:

  1. What is the curl Rest API for user login
  2. What is the curl Rest API for creating API key/JWT

I am not seeing /internal/ api in my V4 docker rest-api swagger. Hope there is no restriction to only use GUI login and then generate API key, there should be a corresponding curl REST APIs as well!

Hello, you can use curl to login as user and to create JWT Token as well.

For user login, see the following:

Endpoint: /api/internal/login
Method: POST
Request Body: JSON object with the following fields:

  • email: User’s email address
  • password: User’s password

Example curl command:
curl -X POST -H “Content-Type: application/json” -d ‘{“email":"user@example.com”,“password”:“password123”}’ http://localhost:8080/api/internal/login

Create API Key/JWT:

Endpoint: /api/internal/api-keys
Method: POST
Request Body: JSON object with the following fields:

  • name: Name of the API key

Example curl command:
curl -X POST -H “Grpc-Metadata-Authorization: Bearer ” -H “Content-Type: application/json” -d ‘{“name”:“My API Key”}’ http://localhost:8080/api/internal/api-keys

you should replace JWT with the token generated.

Hope all this helps,

Nico

Please note that for the ChirpStack REST API image, the internal endpoints are not exposed. You could use the login enpoint in v3, but this is no longer allowed in v4.

This means that you must create an API key through the ChirpStack web-interface, which you then can use for API authorization. Using one API key, you can not create new API keys.

1 Like

Thank you.
For api key generation, the only way is to login to the web-interface and then create token? is there REST API support to login rather than manual login to web-interface?

should i use /api/internal/login not able to find this api in v4 document

1 Like

Correct, you need to login to create this token before you can start making API requests.

1 Like