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

# Create API Key

> Create an API key from the Sudo Dashboard.

Create an API key from the **Developers** page of the Sudo Dashboard.

## How to create an API key

1. Log in to the Sudo Dashboard and click on **Developers**.
2. Select **API Keys**, then click **Create API Key**.

![2880](https://mintcdn.com/sudoafricainc/m0jyIz1tKtQP4CBQ/images/docs/Snip20250925_1.png?fit=max\&auto=format\&n=m0jyIz1tKtQP4CBQ\&q=85\&s=62a3d4abb72fcbfb74ea26c5463570a9)

3. Enter the key's **Name**, **Validity Period**, and optional **IP Address**.
4. Click **Create API Key**.
5. Copy the API key. It is shown only once and cannot be retrieved later.

![2880](https://mintcdn.com/sudoafricainc/m0jyIz1tKtQP4CBQ/images/docs/Snip20250925_2.png?fit=max\&auto=format\&n=m0jyIz1tKtQP4CBQ\&q=85\&s=da08caf9f25e03c634bf947d07a3f192)

> [!TIP]
>
> If an IP address is provided, only requests originating from that IP will be allowed. If no IP is provided, requests from any IP will be allowed.

## IP allowlist

The IP allowlist restricts an API key to approved IP addresses or ranges.

Each request is checked against the public IP address it reaches Sudo from. To add more than one entry on the dashboard, separate them with commas. A request is allowed if it matches any one of the entries.

### Supported IP Formats

Sudo supports the following IP formats for flexibility and security:

| Format Type | Description | Example |
| - | - | - |
| Exact IPv4 | Matches a single IPv4 address | 192.168.1.10 |
| Exact IPv6 | Matches a single IPv6 address. Enter it in lowercase and in its shortened form, with `::` replacing the longest run of zero groups and no leading zeros. Uppercase or fully written-out addresses will not match. | 2c0f:eb58:612:3500:e839:c029:487f:12a7 or 2001:db8::1 |
| IPv6-mapped IPv4 | Requests from an IPv6-mapped IPv4 address are matched against your IPv4 entries. Enter the plain IPv4 address, not the `::ffff:` form. | Request from ::ffff:192.168.1.10 matches the entry 192.168.1.10 |
| CIDR Notation | Matches a subnet range, for IPv4 or IPv6 | 192.168.0.0/16 or 2607:f8b0::/32 |
| Regex Pattern | Dynamic IP matching with a regular expression. Wrap it in forward slashes, without flags such as `i`. The pattern can match anywhere in the IP, so use `^` and `$` to match the whole address. On the dashboard, the pattern cannot contain a comma. | `/^10\.0\.(1\|2)\.[0-9]+$/` |
| Wildcard | Allows all IPs | \*, 0.0.0.0, "", \[\*] |

> [!NOTE]
>
> Some servers can reach Sudo over both IPv4 and IPv6. If yours can, add both addresses, or requests sent over the one you left out will be rejected with `403 Access Restricted: IP not allowed!`. If your IPv6 address changes often, whitelist its range, for example its `/64`, instead of a single address.

> [!CAUTION]
>
> If you think an API key is compromised, delete it from the API keys table and create a new one.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.