> ## Documentation Index
> Fetch the complete documentation index at: https://confidence.spotify.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Clients

> Reference documentation for Confidence clients.

Clients authenticate requests to Confidence from your website, backend service, or mobile app.

<Note>
  Clients are different from API clients. Use **Clients** in your
  application to talk to Confidence to resolve flags or publish events. **API
  clients** talk to Confidence's management APIs, for tasks like
  creating new flags or managing rules.
</Note>

## Client Credentials

After you have created a client, you also need to create a client secret that
you use to authenticate requests to Confidence.

Use the client secret when you initialize a Confidence client SDK, or when
you make API requests to Confidence.

### Integration Type

When creating a client credential, you select an integration type that matches
how your application uses the credential.

* **Backend**: Use for server-side applications where the credential will be
  kept secure. Backend credentials have access to more features.
* **Frontend**: Use for client-side applications (web/mobile apps). Frontend
  credentials may have restricted access for security purposes.

## Credential Rotation

For security purposes, you may need to rotate credentials periodically. The process
involves creating a new credential, updating your application to use it, and then
deleting the old credential.

## Environments

Environments let you separate flag behavior across different deployment stages
like development, staging, and production. You can use the same client across
multiple environments while configuring different credentials for each
environment.

### How Environments Work

Environments work through two configuration points:

1. **Client credentials**: You can associate each credential with specific
   environments. When you link a credential to an environment, the credential
   identifies which environment the resolve request comes from.

2. **Flag rules**: You can limit each rule to specific environments. **Rules
   without environment restrictions apply to all environments.**

When a client resolves flags, Confidence checks which environment the
credential belongs to, then evaluates only the rules that apply to that
environment.

### Associate Credentials with Environments

When creating a client credential, you can specify which environments the
credential applies to. A credential without environments only matches rules
that also have no environments specified.

| Rule Environments | Credential Environments | Rule Enabled |
| ----------------- | ----------------------- | ------------ |
| Empty             | Empty                   | Yes          |
| Empty             | Has values              | Yes          |
| Has values        | Empty                   | No           |
| Has values        | Has matching value      | Yes          |
| Has values        | No matching value       | No           |

This approach allows you to reuse a single client across environments.
Create separate credentials for each environment so that flags resolve based
on the environment of the requesting credential.

<Steps>
  <Step title="Go to the Clients page">
    Navigate to [Clients](https://app.confidence.spotify.com/admin/clients) in the Admin section.
  </Step>

  <Step title="Select the client">
    Select the client to show its credentials.
  </Step>

  <Step title="Open credential options">
    Click the **more options** icon in the top-right corner of the credential.
  </Step>

  <Step title="Edit environments">
    Select **Edit environments** and enable the environments you want for this credential.
  </Step>

  <Step title="Configure flag rules">
    Configure your flag rules to apply only to specific environments in the rule creation flow.
  </Step>
</Steps>

## Related Resources

<CardGroup cols={2}>
  <Card title="Manage Clients" href="/docs/how-to-guides/manage-clients">
    Step-by-step client management guide
  </Card>

  <Card title="SDKs Reference" href="/docs/sdks/introduction">
    Integrate clients in your application
  </Card>

  <Card title="Flag Quickstart" href="/docs/quickstarts/configure-flag">
    End-to-end setup tutorial
  </Card>

  <Card title="Local Resolver" href="/docs/flags/local-resolver">
    Run a local resolver for performance
  </Card>
</CardGroup>
