# API Key Management for DeFi Protocols

Use your API key to securely interact with DeFi protocols across chains. This page shows how to get your key, pass it in requests, and validate that it works.

## 1. Get an API Key
Sign up at [app.blockdaemon.com](https://app.blockdaemon.com/signin) to create an account and generate your DeFi API key.

### Need a DeFi API key?
Interact with a variety of DeFi protocols across many Blockchains through a uniform and consistent API.

## 2. Authenticate Requests

### Method 1: As a Query Parameter
Add your API key to the request URL using `?apiKey=YOUR_API_KEY`.

```curl
curl "https://svc.blockdaemon.com/tokens/v1?apiKey=YOUR_API_KEY"
```

You can use this method with any tool without needing extra steps. Note that if the URL already has other parameters, replace `?` with `&`.

### Method 2: As a Bearer Token
Use the `Authorization` header with your API key as a bearer token.

```curl
curl -X GET "https://svc.blockdaemon.com/tokens/v1" \
  -H "Authorization: Bearer YOUR_API_KEY"
```

### Method 3: As an X-API-Key Header
Add your API key using the `X-API-Key` header.

```curl
curl -X GET "https://svc.blockdaemon.com/tokens/v1" \
  -H "X-API-Key: YOUR_API_KEY"
```

## 3. Test Your API Key
You can try to validate your key by calling the [`/tokens/v1`](https://docs.blockdaemon.com/reference/defi-tokens-get-tokens-metadata) endpoint:

```shell
curl -X GET "https://svc.blockdaemon.com/tokens/v1" \
  -H "X-API-Key: YOUR_API_KEY" | jq
```

A **successful** response returns supported token metadata:

```json
[
    {
      "address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
      "chainID": "eip155:1",
      "decimals": 6,
      "extensions": {
        "homepage": "https://www.circle.com/en/usdc",
        "verified": true
      },
      "logoURI": "https://defi-images-blockdaemon-research-development-int-aa593eebdaa2fd.gitlab.io/tokens/1-0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48.webp",
      "name": "USDC",
      "priceUSD": 0.999737,
      "symbol": "USDC",
      "tags": [
        "stargateV2",
        "stargateV1",
        "stablecoin"
      ]
    }
]
```

If your API key is **invalid** or **missing**, you'll get an error response below:

```json
{
  "type": "https://httpproblems.com/http-status/401",
  "title": "Unauthorized",
  "status": 401,
  "detail": "Authorization Failed",
  "instance": "/defi/chains",
  "trace": {
    "timestamp": "2024-04-30T10:30:30.874Z",
    "requestId": "0b05fee3-b980-4655-a992-5c26f9192edd"
  }
}
```

## Need Help?
Contact us through [email](mailto:support@blockdaemon.com) or our [support page](/content/support/index.html) for any issues, bugs, or assistance you may need.

---

### What's Next

- [SDKs](https://docs.blockdaemon.com/reference/sdks)
