API Token

Pace makes it easy to create API tokens that can be used to consume your application's API from other apps or third-party services. You can name your API tokens for easy identification. Also, you can delete API tokens that are no longer in use or might have been compromised.


Pace comes with a routes/api.ts file where you can define all of your API routes. Routes defined in this file will be prefixed with /api and the auth middleware (using the api guard) applied to them:

// routes/api.ts

Route.group(() => {
  // API routes here

Authenticating with API tokens

Once an API token is created, it can be used to consume your API by passing the token as an Authorization header when making requests:

Authorization = Bearer TOKEN

Disabling API tokens

If API tokens functionality doesn't apply to your application, you can disable it in config/pace.ts:

 apiKeys: false,