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

# Authentication

> Learn how to authenticate with the Archefusion API.

## Overview

The Archefusion API uses API keys to authenticate requests. Every request must include your API key in the `Authorization` header using the `Bearer ` format.

```
Authorization: Bearer YOUR_APIKEY
```

Example:

```javascript theme={null}
'Authorization': “Bearer af_test_ZLMu6giesFq9KbtrTYnEDhFHkCmTx7cmAa9P7n7am7E”
```

## How to get your test API keys

**Step 1**: Log in to your [merchant dashboard](https://app.archefusion.com/sign-in) on Archefusion.

**Step 2**: Add test API credentials to at least one of your configured payment gateways.

**Step 3**: Ensure at least one of your configured payment gateways has been activated. To activate a gateway, toggle its status from inactive to active on the payment gateway configuration page.

<img src="https://mintcdn.com/archefusion/5qT4oADD387Om-sZ/images/activate-gateway.png?fit=max&auto=format&n=5qT4oADD387Om-sZ&q=85&s=620b3f8d60faa71fa6a1c4d3897a5d5a" alt="Active payment gateway" width="1920" height="770" data-path="images/activate-gateway.png" />

**Step 4**: Navigate to "Settings" > "API keys."

**Step 5**: Copy your API key or click "Create New Key" to generate a new one.

<img src="https://mintcdn.com/archefusion/F0e5_vEwsV_HsRw4/images/archefusion-api-key.png?fit=max&auto=format&n=F0e5_vEwsV_HsRw4&q=85&s=2db6ebd8e96f508076dcd462d828631d" alt="Archefusion API Key page" width="1920" height="616" data-path="images/archefusion-api-key.png" />

## How to get your live API keys

**Step 1**: Log in to your [merchant dashboard](https://app.archefusion.com/sign-in) on Archefusion.

**Step 2**: Add live API credentials to at least one of your configured payment gateways.

**Step 3**: Ensure at least one of your configured payment gateways has been activated. To activate a gateway, toggle its status from inactive to active on the payment gateway configuration page.

<img src="https://mintcdn.com/archefusion/5qT4oADD387Om-sZ/images/activate-gateway.png?fit=max&auto=format&n=5qT4oADD387Om-sZ&q=85&s=620b3f8d60faa71fa6a1c4d3897a5d5a" alt="Active payment gateway" width="1920" height="770" data-path="images/activate-gateway.png" />

**Step 4**: Toggle "Live Mode" to go live.

<img src="https://mintcdn.com/archefusion/4PioLo-nyT3x3jlN/images/switch-to-live-mode.png?fit=max&auto=format&n=4PioLo-nyT3x3jlN&q=85&s=21c3b26551bf90770112d737badf7b6b" alt="Switch merchant account to live mode" width="1920" height="655" data-path="images/switch-to-live-mode.png" />

**Step 5**: Navigate to "Settings" > "API keys."

**Step 6**: Click the "Create New Key" button to generate a new API key and copy it.

<img src="https://mintcdn.com/archefusion/5qT4oADD387Om-sZ/images/live-api-key.png?fit=max&auto=format&n=5qT4oADD387Om-sZ&q=85&s=03506945786314869f92663c9deb66ac" alt="Live API keys" width="1857" height="621" data-path="images/live-api-key.png" />

<Warning>
  Copy and store your API key securely once generated. You will not be able to view or copy it again after this step.
</Warning>

## Keep your API keys secure

1. API requests made without a valid API key will return a `401 Unauthorized` error.
2. Store your keys securely using environment variables or secret managers; never hardcode them
3. Never share your keys in public repositories or use them in client-side code.
4. Rotate your API key immediately if you suspect it has been compromised.
