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

# Quickstart

> Create a secret key and make your first API call.

<Steps>
  <Step title="Create a secret key">
    In the Payra dashboard, open **Settings → Integrations** and select **Create key**. Choose **Secret key**, give it a
    name that says where it will run, and select **Create key**. If you do not see the Integrations tab, your role
    may lack the permission to view API keys and webhooks, or the API is not enabled on your workspace: ask a
    workspace admin or Payra. Creating a key needs the permission to manage API keys and webhooks.

    The full key is shown **once**. Copy it into your server's secret manager before you close the dialog.
  </Step>

  <Step title="Call the API">
    Retrieve the account the key belongs to. It is the quickest way to check that a key works:

    ```bash theme={null}
    curl https://api-dashboard.payra.com/v1/account \
      -H "Authorization: Bearer sk_test_..."
    ```

    ```json Response theme={null}
    {
      "object": "account",
      "id": "019ff7ae-d0b5-740d-882c-82322e900300",
      "name": "My workspace",
      "environment": "sandbox",
      "livemode": false
    }
    ```
  </Step>

  <Step title="Take a payment end to end">
    Everything else is the same path, whatever you build on it:

    1. Your server creates a [payment method session](/payment-method-sessions) (`POST /payment-method-sessions`, secret key) and hands its `client_secret` to your page.
    2. Your page mounts [Payra Elements](/elements) with your publishable key and that secret; the customer enters a card or a US bank account and Elements confirms the session. The session reads `succeeded` with the card's brand and last four, or the account's last four.
    3. Your server turns the session into a [payment method](/payment-methods) (`POST /payment-methods`) and charges it (`POST /payments`, with an `Idempotency-Key`). A card answers `succeeded` at once; a bank debit answers `processing` and settles later. A refusal answers `402` and leaves the failed payment readable.
    4. A [webhook endpoint](/webhooks) you registered receives `payment.succeeded`, `payment.failed` or `payment.returned`, signed; `GET /events/{id}` shows every delivery.
    5. Money goes back through a [refund](/refunds) (`POST /refunds`), once the payment has settled.

    Do this once against your sandbox workspace with a test card; then read [Environments](/environments)
    for what changes when you go live.
  </Step>
</Steps>

## Next steps

<CardGroup cols={2}>
  <Card title="Payra Elements" icon="credit-card" href="/elements">
    Secure card or bank account fields for your page, tokenized before they reach Payra.
  </Card>

  <Card title="Payments" icon="money-bill" href="/payments">
    Charge a card at once, or debit a bank account and follow it to settlement.
  </Card>

  <Card title="Errors" icon="triangle-exclamation" href="/errors">
    The error format every endpoint shares.
  </Card>

  <Card title="Rate limits" icon="gauge" href="/rate-limits">
    How many requests a key can make, and how to back off.
  </Card>
</CardGroup>
