> ## Documentation Index
> Fetch the complete documentation index at: https://neuroai-cf1c4abf.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Quick Start

> This guide will walk you through creating your first NeuroAI API key and making your first authenticated API request. No prior setup required—just follow these simple steps to start integrating NeuroAI into your applications.  

<Card title="Full API Keys Documentation" icon="book" horizontal href="/api-keys">
  Need more details? View the complete API Keys guide with security best practices and advanced features.
</Card>

## What You'll Learn

<CardGroup cols={2}>
  <Card title="Create Your First Key" icon="key">
    Generate an API key in under 2 minutes
  </Card>

  <Card title="Authenticate Requests" icon="shield-check">
    Make your first authenticated API call
  </Card>

  <Card title="Test & Verify" icon="vial">
    Verify your API key is working correctly
  </Card>

  <Card title="Best Practices" icon="star">
    Learn essential security practices
  </Card>
</CardGroup>

## Step 1: Create Your API Key

<Tabs>
  <Tab title="Dashboard">
    ### Using the Dashboard

    1. Log in to your NeuroAI account
    2. Navigate to **Settings** → **Users and Teams** → **API Keys**
    3. Click **Create API Key**
    4. Fill in the details:
       ```text theme={null}
       Name: My First API Key
       Description: Testing API integration
       Role: Developer
       Expiration: (optional) 90 days
       ```
    5. Click **Create**

    <Warning>
      ⚠️ **Important**: Copy your API key immediately and store it securely—you won't be able to see it again!
    </Warning>

    Your API key will look something like this:

    ```text theme={null}
    neuro_sk_1234567890abcdefghijklmnopqrstuvwxyz
    ```
  </Tab>

  <Tab title="API">
    ### Using the API

    If you already have an access token, create an API key programmatically:

    ```bash theme={null}
    curl -X POST "https://api.neuroai.com/v1/api-keys" \
      -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
      -H "Content-Type: application/json" \
      -d '{
        "name": "My First API Key",
        "description": "Testing API integration",
        "role": "developer"
      }'
    ```

    The response will include your new API key:

    ```json theme={null}
    {
      "id": "key_abc123",
      "key": "neuro_sk_1234567890abcdefghijklmnopqrstuvwxyz",
      "name": "My First API Key",
      "role": "developer",
      "created_at": "2026-01-12T10:00:00Z"
    }
    ```
  </Tab>
</Tabs>

## Step 2: Store Your API Key Securely

<Note>
  Never commit API keys to version control or hardcode them in your application source code.
</Note>

Create a `.env` file in your project directory:

```bash theme={null}
# .env
NEUROAI_API_KEY=neuro_sk_1234567890abcdefghijklmnopqrstuvwxyz
NEUROAI_API_BASE=https://api.neuroai.com/v1
```

Add `.env` to your `.gitignore`:

```bash theme={null}
# .gitignore
.env
.env.local
*.env
```

## Step 3: Make Your First API Call

<Tabs>
  <Tab title="cURL">
    ### Using cURL

    Test your API key with a simple request:

    ```bash theme={null}
    curl "https://api.neuroai.com/v1/agents" \
      -H "Authorization: Bearer neuro_sk_1234567890abcdefghijklmnopqrstuvwxyz"
    ```

    Or using environment variables:

    ```bash theme={null}
    # Set your API key
    export NEUROAI_API_KEY="neuro_sk_1234567890abcdefghijklmnopqrstuvwxyz"

    # Make the request
    curl "https://api.neuroai.com/v1/agents" \
      -H "Authorization: Bearer $NEUROAI_API_KEY"
    ```
  </Tab>

  <Tab title="Python">
    ### Using Python

    Install the requests library:

    ```bash theme={null}
    pip install requests python-dotenv
    ```

    Create a test script:

    ```python theme={null}
    import os
    from dotenv import load_dotenv
    import requests

    # Load environment variables
    load_dotenv()

    # Get API key
    api_key = os.getenv('NEUROAI_API_KEY')

    # Make authenticated request
    headers = {
        'Authorization': f'Bearer {api_key}',
        'Content-Type': 'application/json'
    }

    response = requests.get(
        'https://api.neuroai.com/v1/agents',
        headers=headers
    )

    # Print the results
    if response.status_code == 200:
        print("✅ Success! Your API key is working.")
        print(response.json())
    else:
        print(f"❌ Error: {response.status_code}")
        print(response.text)
    ```

    Run your script:

    ```bash theme={null}
    python test_api.py
    ```
  </Tab>

  <Tab title="Node.js">
    ### Using Node.js

    Install dependencies:

    ```bash theme={null}
    npm install axios dotenv
    ```

    Create a test script:

    ```javascript theme={null}
    require('dotenv').config();
    const axios = require('axios');

    // Get API key from environment
    const apiKey = process.env.NEUROAI_API_KEY;

    // Create API client
    const client = axios.create({
      baseURL: 'https://api.neuroai.com/v1',
      headers: {
        'Authorization': `Bearer ${apiKey}`,
        'Content-Type': 'application/json'
      }
    });

    // Make authenticated request
    async function testApiKey() {
      try {
        const response = await client.get('/agents');
        console.log('✅ Success! Your API key is working.');
        console.log(response.data);
      } catch (error) {
        console.error('❌ Error:', error.response?.status);
        console.error(error.response?.data);
      }
    }

    testApiKey();
    ```

    Run your script:

    ```bash theme={null}
    node test_api.js
    ```
  </Tab>
</Tabs>

## Step 4: Verify Your API Key

Test that your API key is valid and check its permissions:

```bash theme={null}
curl "https://api.neuroai.com/v1/auth/verify" \
  -H "Authorization: Bearer $NEUROAI_API_KEY"
```

Expected response:

```json theme={null}
{
  "valid": true,
  "key_id": "key_abc123",
  "name": "My First API Key",
  "role": "developer",
  "permissions": ["agents:read", "agents:create", "workflows:execute"],
  "expires_at": "2026-04-12T10:00:00Z"
}
```

<Check>
  ✅ If you see `"valid": true`, your API key is working correctly!
</Check>

## Common API Operations

Now that your API key is set up, try these common operations:

<CardGroup cols={2}>
  <Card title="List Agents" icon="list">
    ```bash theme={null}
    GET /v1/agents
    ```

    View all available AI agents
  </Card>

  <Card title="Create Task" icon="plus">
    ```bash theme={null}
    POST /v1/tasks
    ```

    Create a new AI task
  </Card>

  <Card title="Upload File" icon="upload">
    ```bash theme={null}
    POST /v1/files
    ```

    Upload files for processing
  </Card>

  <Card title="Get Task Status" icon="info">
    ```bash theme={null}
    GET /v1/tasks/{task_id}
    ```

    Check task completion status
  </Card>
</CardGroup>

### Example: Create a Task

```bash theme={null}
curl -X POST "https://api.neuroai.com/v1/tasks" \
  -H "Authorization: Bearer $NEUROAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "instruction": "Analyze this quarterly report and summarize key findings",
    "agent_type": "analyst",
    "attachments": ["file_id_123"]
  }'
```

## Security Best Practices

<CardGroup cols={2}>
  <Card title="Environment Variables" icon="lock">
    Store keys in `.env` files, never in source code
  </Card>

  <Card title="Separate Keys" icon="layer-group">
    Use different keys for dev, staging, and production
  </Card>

  <Card title="Rotate Regularly" icon="rotate">
    Change your API keys every 90 days
  </Card>

  <Card title="Monitor Usage" icon="chart-line">
    Track API key activity for suspicious patterns
  </Card>
</CardGroup>

### Quick Security Checklist

* ✅ Store API keys in environment variables
* ✅ Add `.env` to `.gitignore`
* ✅ Use separate keys per environment
* ✅ Set expiration dates for keys
* ✅ Use minimum required permissions
* ❌ Never commit keys to version control
* ❌ Don't share keys via email or chat
* ❌ Avoid logging API keys

## Troubleshooting

<AccordionGroup>
  <Accordion title="401 Unauthorized Error">
    **Problem**: Your request is being rejected with a 401 error.

    **Solutions**:

    * Verify your API key is correct (no extra spaces or characters)
    * Check the Authorization header format: `Bearer YOUR_API_KEY`
    * Ensure the API key hasn't been revoked or expired
    * Confirm you're using the correct API base URL

    **Test your key**:

    ```bash theme={null}
    curl "https://api.neuroai.com/v1/auth/verify" \
      -H "Authorization: Bearer $NEUROAI_API_KEY"
    ```
  </Accordion>

  <Accordion title="403 Forbidden Error">
    **Problem**: Your API key doesn't have permission for this operation.

    **Solutions**:

    * Check your API key's role and permissions
    * Use a key with higher privileges (e.g., Administrator)
    * Create a new key with the required permissions

    **Check permissions**:

    ```bash theme={null}
    curl "https://api.neuroai.com/v1/api-keys/CURRENT_KEY_ID" \
      -H "Authorization: Bearer $NEUROAI_API_KEY"
    ```
  </Accordion>

  <Accordion title="Can't Find My API Key">
    **Problem**: You lost or forgot your API key.

    **Solutions**:

    * API keys cannot be retrieved after creation
    * Create a new API key from the dashboard
    * Revoke the old key if you're concerned about security
    * Update your applications with the new key
  </Accordion>

  <Accordion title="Environment Variables Not Loading">
    **Problem**: Your code can't read the API key from `.env`.

    **Solutions for Python**:

    ```bash theme={null}
    pip install python-dotenv
    ```

    ```python theme={null}
    from dotenv import load_dotenv
    load_dotenv()  # Add this at the top of your script
    ```

    **Solutions for Node.js**:

    ```bash theme={null}
    npm install dotenv
    ```

    ```javascript theme={null}
    require('dotenv').config();  // Add this at the top
    ```

    **Verify the file exists**:

    ```bash theme={null}
    ls -la | grep .env
    cat .env  # Make sure API key is there
    ```
  </Accordion>
</AccordionGroup>

## Next Steps

<CardGroup cols={3}>
  <Card title="Full API Keys Guide" icon="book" href="/api-keys">
    Learn about key types, permissions, and advanced features
  </Card>

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

  <Card title="Security Guide" icon="shield" href="/api-keys#security-best-practices">
    Deep dive into API key security
  </Card>

  <Card title="Rate Limits" icon="gauge" href="/rate-limits">
    Understand API rate limits and quotas
  </Card>

  <Card title="Webhooks" icon="webhook" href="/webhooks">
    Set up real-time notifications
  </Card>

  <Card title="Examples" icon="flask" href="/examples">
    View complete integration examples
  </Card>
</CardGroup>

## Quick Reference

<AccordionGroup>
  <Accordion title="Authentication Headers">
    **Bearer Token** (Recommended):

    ```bash theme={null}
    Authorization: Bearer neuro_sk_your_key_here
    ```

    **X-API-Key Header**:

    ```bash theme={null}
    X-API-Key: neuro_sk_your_key_here
    ```

    **Query Parameter** (Not recommended for production):

    ```bash theme={null}
    ?api_key=neuro_sk_your_key_here
    ```
  </Accordion>

  <Accordion title="Environment Setup">
    **Create .env file**:

    ```bash theme={null}
    NEUROAI_API_KEY=neuro_sk_your_key_here
    NEUROAI_API_BASE=https://api.neuroai.com/v1
    ```

    **Load in Python**:

    ```python theme={null}
    from dotenv import load_dotenv
    import os
    load_dotenv()
    api_key = os.getenv('NEUROAI_API_KEY')
    ```

    **Load in Node.js**:

    ```javascript theme={null}
    require('dotenv').config();
    const apiKey = process.env.NEUROAI_API_KEY;
    ```
  </Accordion>

  <Accordion title="Common Endpoints">
    * **Verify Key**: `GET /v1/auth/verify`
    * **List Agents**: `GET /v1/agents`
    * **Create Task**: `POST /v1/tasks`
    * **Get Task**: `GET /v1/tasks/{task_id}`
    * **Upload File**: `POST /v1/files`
    * **List API Keys**: `GET /v1/api-keys`
  </Accordion>

  <Accordion title="API Key Management">
    **Create Key**:

    ```bash theme={null}
    POST /v1/api-keys
    ```

    **List Keys**:

    ```bash theme={null}
    GET /v1/api-keys
    ```

    **Rotate Key**:

    ```bash theme={null}
    POST /v1/api-keys/{key_id}/rotate
    ```

    **Delete Key**:

    ```bash theme={null}
    DELETE /v1/api-keys/{key_id}
    ```
  </Accordion>
</AccordionGroup>

## Get Help

<CardGroup>
  <Card title="Documentation" icon="book">
    Browse comprehensive guides and tutorials
  </Card>

  <Card title="API Status" icon="signal">
    Check real-time API availability
  </Card>

  <Card title="Support" icon="headset">
    Contact our support team
  </Card>

  <Card title="Community" icon="comments">
    Join the developer community
  </Card>
</CardGroup>
