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

# Quickstart Guide

> Get up and running with the taap.it API in minutes

This quickstart guide will walk you through making your first API call to the taap.it API.

## Prerequisites

Before you begin, you'll need:

* A taap.it account
* An API key (created through the web dashboard)
* A tool to make HTTP requests (curl, Postman, or your preferred client)

## Step 1: Create an API Key

<Steps>
  <Step title="Log into taap.it Dashboard">
    Visit [www.taap.it](https://www.taap.it) and log into your account.
  </Step>

  <Step title="Navigate to API Settings">
    Go to your user settings and find the "API Keys" section.
  </Step>

  <Step title="Generate New Key">
    Click "Create API Key" and give it a descriptive name. Copy the generated key immediately.

    <Warning>
      API keys are only shown once during creation. Make sure to copy and store them securely.
    </Warning>
  </Step>
</Steps>

Your API key will look like this: `taapit_abc123def456ghi789jkl012mno345pqr678stu901vwx234yz`

## Step 2: Make Your First Request

Let's start by listing your existing links to verify your API key is working:

```bash cURL theme={null}
curl -X GET 'https://api.taap.it/v1/links' \
  -H 'Authorization: Bearer taapit_your_api_key_here' \
  -H 'Content-Type: application/json'
```

**Response:**

```json theme={null}
{
  "items": [],
  "page": 1,
  "page_size": 20,
  "has_next": false
}
```

## Step 3: Create Your First Link

Now let's create a deeplink:

```bash cURL theme={null}
curl -X POST 'https://api.taap.it/v1/links' \
  -H 'Authorization: Bearer taapit_your_api_key_here' \
  -H 'Content-Type: application/json' \
  -d '{
    "original_url": "https://example.com/very-long-url-that-needs-shortening",
    "custom_code": "my-custom-link"
  }'
```

**Response:**

```json theme={null}
{
  "id": "link_987654321",
  "original_url": "https://example.com/very-long-url-that-needs-shortening",
  "short_url": "https://taap.it/my-custom-link",
  "code": "my-custom-link",
  "created_at": "2024-01-15T10:35:00Z",
  "updated_at": "2024-01-15T10:35:00Z",
  "click_count": 0,
  "is_active": true
}
```

## Step 4: Get Link Analytics

Let's check the analytics for your newly created link:

```bash cURL theme={null}
curl -X GET 'https://api.taap.it/v1/stats/links/link_987654321' \
  -H 'Authorization: Bearer taapit_your_api_key_here' \
  -H 'Content-Type: application/json'
```

**Response:**

```json theme={null}
[
  {
    "link_id": "link_987654321",
    "click_date": "2024-01-15",
    "total_clicks": 0,
    "unique_visitors": 0,
    "country_stats": {},
    "device_stats": {},
    "browser_stats": {},
    "scans_only": 0
  }
]
```

## Next Steps

<CardGroup cols={2}>
  <Card title="Explore Domains" icon="globe" href="/api-reference/domains">
    Learn how to manage custom domains for your deeplinks
  </Card>

  <Card title="Project Management" icon="folder" href="/api-reference/projects">
    Organize your links into projects for better management
  </Card>

  <Card title="Advanced Analytics" icon="chart-line" href="/api-reference/stats">
    Dive deeper into link performance and user analytics
  </Card>

  <Card title="Links Management" icon="link" href="/api-reference/links">
    Create, update, and manage your deeplinks
  </Card>
</CardGroup>

## Common Patterns

### Error Handling

Always check for errors in API responses:

```javascript JavaScript Example theme={null}
const response = await fetch('https://api.taap.it/v1/links', {
  headers: {
    'Authorization': `Bearer ${apiKey}`,
    'Content-Type': 'application/json'
  }
});

if (!response.ok) {
  const error = await response.json();
  console.error('API Error:', error.detail);
  return;
}

const data = await response.json();
console.log('Success:', data);
```

### Rate Limit Handling

Handle rate limits gracefully:

```javascript JavaScript Example theme={null}
async function makeRequest(url, options) {
  const response = await fetch(url, options);
  
  if (response.status === 429) {
    const retryAfter = response.headers.get('Retry-After');
    console.log(`Rate limited. Retry after ${retryAfter} seconds`);
    await new Promise(resolve => setTimeout(resolve, retryAfter * 1000));
    return makeRequest(url, options); // Retry
  }
  
  return response;
}
```

## Need Help?

<AccordionGroup>
  <Accordion title="Authentication Issues">
    * Verify your API key is correct and active
    * Ensure you're using the `Bearer` prefix in the Authorization header
    * Check that your API key hasn't expired
  </Accordion>

  <Accordion title="Rate Limiting">
    * Implement exponential backoff for retries
    * Monitor the `X-RateLimit-Remaining` header
    * Consider caching responses to reduce API calls
  </Accordion>

  <Accordion title="Common Errors">
    * **401 Unauthorized**: Invalid or missing API key
    * **403 Forbidden**: Insufficient permissions for the requested resource
    * **404 Not Found**: Resource doesn't exist or you don't have access
    * **409 Conflict**: Resource already exists (e.g., duplicate custom code)
  </Accordion>
</AccordionGroup>

<Card title="Ready to build?" icon="code" href="/api-reference">
  Explore our complete API reference to unlock the full power of taap.it.
</Card>
