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

# API Overview

> In this page you will learn how to work with the the OPENFORMAT API

## Authentication

Authentication for the OPENFORMAT API involves the use of an API Key, which is a secure credential that is tied to a specific Ethereum account address. This key should be included in the header of the request.

```curl theme={null}
--header 'X-API-KEY: <OPENFORMAT_API_KEY>'
```

<Warning>
  It is advised not to hardcode your credentials in a file in
  production environments. Use environment variables instead.
</Warning>

## API Endpoints

OPENFORMAT provides a multitude of API endpoints that enable a variety of functionalities.
the base URL for the the OPENFORMAT API is `https://api.openformat.tech`.

For instance, to get leaderboard data, the endpoint to use would look like this `https://api.openformat.tech/v1/leaderboard`.

## Generating an API Key

You can generate an API Key in the [API Reference](/api-reference/endpoint/api-key/post-keychallenge). The process involves two steps: `challenge` and `verify`. As mentioned, an API Key is associated with a specific Ethereum account address. To achieve this, you must generate a challenge, sign it with your account address, and then verify the signed challenge.

We've developed a [signing tool](https://openformat-tools.vercel.app/) for signing messages with Metamask. If you prefer to sign messages locally, you can use the following scripts:

<CodeGroup>
  ```tsx viem (Recommended) theme={null}
  import { privateKeyToAccount } from "viem/accounts";

  const account = privateKeyToAccount("YOUR_PRIVATE_KEY");

  // Challenge returned from /key/challenge endpoint
  const challenge = "7877fa9f42dd92bebfefa7d6469e774327afddf76718e93288182949af7d3ade";

  const signed = await account.signMessage({ message: challenge });

  console.log(signed);
  // 0x9fe5ad28c81419f5135aec3c....

  ```

  ```tsx ethers theme={null}
  import { ethers } from "ethers";

  const privateKey = "YOUR_PRIVATE_KEY";
  const wallet = new ethers.Wallet(privateKey);

  // Challenge returned from /key/challenge endpoint
  const challenge = "7877fa9f42dd92bebfefa7d6469e774327afddf76718e93288182949af7d3ade";

  const signed = await wallet.signMessage(challenge);

  console.log(signed);
  // 0x9fe5ad28c81419f5135aec3c....
  ```
</CodeGroup>

## Transaction Lifecycle

We recommend reading and understanding the [Transaction Lifecycle](/api-reference/architecture/transaction-lifecycle) before continuing.
