APIs & Authentication

Once you have a Resource defined, Clarabase will automatically generate an OpenAPI spec and GraphQL schema for you. You may make HTTP requests with JSON data or GraphQL queries. (There are more APIs on the roadmap, including HTTP-Avro and gRPC, both will be excellent for your high performance needs)

You can make requests directly in the browser using the OpenAPI dashboard (authentication will be handled automatically for you). This is a great way to experiment with your API and get an idea of how to make the requests.

In addition, you can also manage your resource with the provided GraphQL API. You can use the GraphiQL interface to experiment with making calls via the GraphQL API and to view the GraphQL schema.

Authentication

Authentication is achieved by requesting an auth token with your client credentials. Your credentials can be found in the Settings Page. You will need to generate a client secret to start requesting access tokens if you haven't done so already.. Note that you will only be able to see your secret once, so be sure to copy it securely immediately, otherwise you'll have to generate a new secret.

You can generate a new secret at anytime, and it's encouraged to do so regularly, by regenerating one from the Settings Page. Note this will invalidate any existing, unexpired tokens that have already been issued. Note that authentication is handled automatically when using one of the Clarabase SDKs or starter code.

To request a token with your client credentials, you simply need to make a POST /auth/token request with your client_id and client_secret. The response will return an access token that should be sent in an authorization header when making API requests, for example Authorization: Bearer <accessToken>.

If the access token expires or is invalidated, a new one can be created by making another request to get an accessToken.

Last updated