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

# Authentication

> Authenticate the Switch REST API with your service key (x-service-key) for sandbox and production crypto payment and settlement requests.

You can view both keys anytime in the Switch dashboard. Both keys works with the same base URL `https://api.onswitch.xyz`.

## Example request

<CodeGroup>
  ```bash curl theme={"dark"}
  curl https://api.onswitch.xyz/asset \
    -H "x-service-key: $YOUR_SERVICE_KEY" \
    -H "Accept: application/json"
  ```

  ```javascript Node.js theme={"dark"}
  const res = await fetch('https://api.onswitch.xyz/asset', {
    headers: {
      'x-service-key': process.env.YOUR_SERVICE_KEY,
      'Accept': 'application/json',
    },
  });
  ```

  ```python Python theme={"dark"}
  import os, urllib.request

  req = urllib.request.Request(
    "https://api.onswitch.xyz/asset",
    headers={
      "x-service-key": os.environ["YOUR_SERVICE_KEY"],
      "Accept": "application/json",
    },
  )
  urllib.request.urlopen(req, timeout=30)
  ```
</CodeGroup>

Use your *live key* only when it's production environment, as this might involve live onchain transactions and actual money movement.

<Warning>
  If your key may is exposed or compromised, quickly rotate it from the dashboard or contact support at [contact@onswitch.xyz](mailto:contact@onswitch.xyz) for assistance.
</Warning>

## Need Help?

<CardGroup cols={2}>
  <Card title="Email" icon="mail" href="mailto:contact@onswitch.xyz">
    Send us a message
  </Card>

  <Card title="Call" icon="calendar" href="https://calendly.com/contact-onswitch/30min">
    Book a call with us
  </Card>
</CardGroup>
