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

# Authentication

> Learn how to authenticate with the Pulse API

## Overview

All Pulse API endpoints require authentication using an API key. This key identifies your organization and tracks usage for billing purposes.

## Getting Your API Key

<Steps>
  <Step title="Sign Up">
    Create an account at [platform.runpulse.com/](https://platform.runpulse.com/)
  </Step>

  <Step title="Generate API Key">
    Navigate to the API Keys section in your dashboard
  </Step>

  <Step title="Copy Your Key">
    Click "Create New Key" and copy the generated key immediately
  </Step>
</Steps>

<Warning>
  API keys are shown only once when created. Store them securely - you cannot retrieve them later.
</Warning>

## Using Your API Key

### With the Official SDKs (Recommended)

<CodeGroup>
  ```python Python theme={null}
  from pulse import Pulse

  # Initialize the client with your API key
  client = Pulse(api_key="YOUR_API_KEY")

  # Extract a document
  response = client.extract(
      file_url="https://www.impact-bank.com/user/file/dummy_statement.pdf"
  )

  print(f"Extraction ID: {response.extraction_id}")
  print(f"Markdown: {response.markdown[:200]}...")
  ```

  ```typescript TypeScript theme={null}
  import { PulseClient } from 'pulse-ts-sdk';

  // Initialize the client with your API key
  const client = new PulseClient({ 
      apiKey: 'YOUR_API_KEY'
  });

  // Extract a document
  const response = await client.extract({
      fileUrl: "https://www.impact-bank.com/user/file/dummy_statement.pdf"
  });

  console.log(`Extraction ID: ${response.extraction_id}`);
  console.log(`Markdown: ${response.markdown?.substring(0, 200)}...`);
  ```

  ```bash curl theme={null}
  curl -X POST https://api.runpulse.com/extract \
    -H "x-api-key: YOUR_API_KEY" \
    -F "file=@document.pdf"
  ```
</CodeGroup>

### Install the SDKs

<CodeGroup>
  ```bash Python theme={null}
  pip install pulse-python-sdk
  ```

  ```bash TypeScript theme={null}
  npm install pulse-ts-sdk
  ```
</CodeGroup>

## API Key Security

<AccordionGroup>
  <Accordion title="Best Practices">
    * **Never expose API keys in client-side code** - Use server-side proxies
    * **Use environment variables** - Don't hardcode keys in your source code
    * **Rotate keys regularly** - Generate new keys periodically
    * **Use separate keys** - Different keys for development, staging, and production
  </Accordion>

  <Accordion title="Environment Variables">
    Store your API key in environment variables:

    ```bash .env theme={null}
    PULSE_API_KEY=your_api_key_here
    ```

    <CodeGroup>
      ```python Python theme={null}
      import os
      from pulse import Pulse

      client = Pulse(api_key=os.getenv("PULSE_API_KEY"))
      ```

      ```typescript TypeScript theme={null}
      import { PulseClient } from 'pulse-ts-sdk';

      const client = new PulseClient({
          apiKey: process.env.PULSE_API_KEY!
      });
      ```
    </CodeGroup>
  </Accordion>

  <Accordion title="Key Rotation">
    To rotate your API key:

    1. Generate a new key in the Platform
    2. Update your application to use the new key
    3. Verify the new key is working
    4. Delete the old key from the Platform
  </Accordion>
</AccordionGroup>

## Managing API Keys

### View Active Keys

Access your API keys at the [Platform](https://platform.runpulse.com):

* See all active keys
* View creation dates
* Monitor usage per key
* Delete compromised keys

### Key Permissions

All API keys have full access to:

* Document extraction endpoints
* File upload endpoints
* Job management endpoints
* Webhook configuration

<Note>
  Fine-grained permissions are coming soon. Contact support if you need restricted access patterns.
</Note>

## Troubleshooting

### Common Authentication Errors

<AccordionGroup>
  <Accordion title="AUTH_001: API key is required">
    **Solution**: Ensure you're providing your API key when initializing the client

    <CodeGroup>
      ```python Python theme={null}
      from pulse import Pulse

      client = Pulse(api_key="YOUR_API_KEY")
      ```

      ```typescript TypeScript theme={null}
      import { PulseClient } from "pulse-ts-sdk";

      const client = new PulseClient({
          apiKey: "YOUR_API_KEY"
      });
      ```

      ```bash curl theme={null}
      # Include in all requests:
      -H "x-api-key: YOUR_API_KEY"
      ```
    </CodeGroup>
  </Accordion>

  <Accordion title="AUTH_002: Invalid API key">
    **Possible causes**:

    * Key was typed incorrectly
    * Key has been deleted
    * Using a key from a different environment

    **Solution**: Verify your key in the Platform and ensure you're copying it correctly
  </Accordion>

  <Accordion title="BILLING_001: Monthly page limit exceeded">
    **Solution**:

    * Check your usage in the Platform
    * Upgrade your plan for higher limits
    * Contact support for temporary limit increases
  </Accordion>
</AccordionGroup>

## Next Steps

<CardGroup cols={2}>
  <Card title="Quickstart Guide" icon="rocket" href="/quickstart">
    Start making your first API calls
  </Card>

  <Card title="API Reference" icon="code" href="/api-reference/introduction">
    Explore available endpoints
  </Card>
</CardGroup>
