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

# POST & PATCH /v1/keys

> Create a self-serve API key, then set your own swap fee and payout addresses.

Two endpoints on the same resource: `POST` creates a key, `PATCH` updates the fee and payout
addresses on a key you already have. See [Get an API key](/tools/get-api-key) for the hosted
signup form, and [Pricing](/pricing) for how the fee you set here turns into a payout.

## Create a key: POST /v1/keys

<ParamField body="email" type="string" required>Where you receive your key and any partnership follow-up.</ParamField>

<ParamField body="projectName" type="string" required />

<ParamField body="website" type="string" required>A valid URL.</ParamField>

<ParamField body="telegram" type="string" required />

<ParamField body="twitter" type="string" required />

<ParamField body="discord" type="string">Optional.</ParamField>
<ParamField body="blurb" type="string">Optional, one line on what you're building.</ParamField>
<ParamField body="category" type="string">Optional.</ParamField>
<ParamField body="chains" type="string[]">Optional.</ParamField>
<ParamField body="apisPlanned" type="string[]">Optional.</ParamField>

<ParamField body="feeBps" type="integer">
  Your swap fee in basis points, 0 to 100 (1%). Omit or send `0` to start at 0%; you can raise it
  later with `PATCH`. See [Pricing](/pricing#setting-your-own-fee) for what you actually receive of
  whatever you set.
</ParamField>

No API key required to call this endpoint; it's how you get one. Rate-limited to 5 signups/min
per IP.

```bash theme={null}
curl -s -X POST https://app.ravn.exchange/api/v1/keys \
  -H 'content-type: application/json' -d '{
    "email": "you@project.xyz",
    "projectName": "Your Project",
    "website": "https://project.xyz",
    "telegram": "@yourproject",
    "twitter": "@yourproject",
    "feeBps": 20
  }'
```

<ResponseField name="apiKey" type="string">Pass as the `x-api-key` header on every other v1 request.</ResponseField>

<ResponseField name="partnerId" type="string" />

<ResponseField name="feeBps" type="integer">The fee now active on this key, `0` if omitted above.</ResponseField>

```json theme={null}
{ "data": { "apiKey": "rvn_live_...", "partnerId": "...", "feeBps": 20 } }
```

## Update a key: PATCH /v1/keys

Change the calling key's own fee and/or register where its share of collected fees gets paid
out. Authenticated by the same `x-api-key` header as every other endpoint; the key itself is
your proof of ownership. At least one of `feeBps` or `payoutAddresses` is required.

<ParamField body="feeBps" type="integer">0 to 100 (1%). Self-serve keys only (see the note below).</ParamField>

<ParamField body="payoutAddresses" type="object">
  One or more of `evm`, `solana`, `thorchain` (must match `thor1…`, 38 lowercase alphanumeric
  characters after the prefix). Registers where that ecosystem's earned balance is sent. See
  [Pricing](/pricing#getting-paid) for what happens if a balance accrues with no address on file.
</ParamField>

```bash theme={null}
curl -s -X PATCH https://app.ravn.exchange/api/v1/keys \
  -H 'x-api-key: rvn_live_your_key_here' \
  -H 'content-type: application/json' -d '{
    "feeBps": 25,
    "payoutAddresses": { "evm": "0xYourPayoutAddress" }
  }'
```

```json theme={null}
{ "data": { "feeBps": 25, "payoutAddresses": { "evm": "0xYourPayoutAddress" } } }
```

<Note>
  **Enterprise keys set `feeBps` a different way.** Enterprise keys aren't self-serve rows, so a
  `feeBps` update here returns `404 NOT_FOUND` for one. Your fee on an enterprise key is set
  directly by RAVN as part of your arrangement (see [Authentication](/authentication#enterprise-partnerships)).
  `payoutAddresses` still works on an enterprise key; only `feeBps` is restricted.
</Note>

<Warning>
  Returns `401 UNAUTHORIZED` with no `x-api-key` header (there's no anonymous key to update),
  `404 NOT_FOUND` on a `feeBps` update for a non-self-serve key, and `400 INVALID_REQUEST` if
  neither field is present or a value fails validation (an out-of-range `feeBps`, or a malformed
  `thorchain` address).
</Warning>
