On this page

Learn about API keys, their secure usage, and authentication methods. Ensure data protection with these essential API key explanations.

**What's an API Key ?**

An API Key is a resource that allows you to manage some resources on your Cryptr service through REST depending on its scope of permissions.

Using a client_credentials flow you'll be able to authenticate your requests.

### 1. Where can I find my API Key?

During your onboarding you get a sandbox API Key.

To find this Key:

1. Login to your Cryptr Account on [cryptr.co](/content/site-root.html).

2. Once logged in, your key is located at the top of your home page.

### 2. How to Safely Utilize Your API Keys

It's **important** that your Cryptr API Keys **remains secret**, we encourage you to define them as environment variables such as

```bash
CRYPTR_ACCOUNT_DOMAIN=communitiz-app
CRYPTR_CLIENT_ID=b7bde828-4df1-4f62-9a3a-d1541a2fc9e4
CRYPTR_CLIENT_SECRET=79cef058-530c-4c19-a12d-ff57ff5e592b
```

In a dedicated environment, remember to set the `CRYPTR_SERVICE_URL` as environment_variable.

This ensures proper communication with the service and enables customization of service URL based on your environment.

Cryptr Service URL for dedicated instance

```text
CRYPTR_ACCOUNT_DOMAIN=communitiz-app
CRYPTR_CLIENT_SECRET=79cef058-530c-4c19-a12d-ff57ff5e592b
CRYPTR_CLIENT_ID=b7bde828-4df1-4f62-9a3a-d1541a2fc9e4
CRYPTR_SERVICE_URL=https://comumnitiz-app.authent.me
```

### 3. How to Authenticate with Your API Key

Since your API Key is known from your application you can now use the `client_credentials` OAuth flow to authenticate your request on our API.

Here is an example of how to retrieve and access token:

```bash
curl -X POST '${cryptr_service_url}/oauth/token' \
  -d grant_type="client_credentials" \
  -d client_id="${cryptr_client_id}" \
  -d client_secret="${cryptr_client_secret}" \
  -d audience="communitiz-app" \
```

From this request you'll get an `access_token` that you'll have to use as Authorization Bearer header in your requests.

For example if you want to create a new Organization here is an example:

```bash
curl -X POST '${cryptr_service_url}/api/v2/organizations' \
--header 'Authorization: Bearer eyJ...' \
-d name='New company' \
-d 'allowed_email_domains[]'='company.co'
```

## What's next

[Cryptr API Exploration with Postman](https://www.postman.com/cryptr)

Discover how to authenticate and utilize the Cryptr collection requests with this guide.
