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

# Quickstart

> Start using Snip API in under 5 minutes

## Get Your API Key

<Steps>
  <Step title="Sign Up">
    Create an account at [snip.sa](https://snip.sa) if you haven't already
  </Step>

  <Step title="Navigate to Profile">
    Go to your dashboard and click on **Profile** in the sidebar
  </Step>

  <Step title="Generate API Key">
    Click **"Regenerate API Key"** to create your API key
  </Step>

  <Step title="Copy and Store">
    Copy your API key and store it securely - you'll need it for all API requests
  </Step>
</Steps>

<Warning>
  Keep your API key secure! Never share it publicly or commit it to version control.
</Warning>

## Make Your First Request

Let's create your first shortened URL:

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST https://snip.sa/api/urls \
    -H "Content-Type: application/json" \
    -H "X-API-Key: your_api_key_here" \
    -d '{
      "originalUrl": "https://example.com/very-long-url",
      "title": "My First Link"
    }'
  ```

  ```javascript JavaScript theme={null}
  const axios = require('axios');

  const response = await axios.post('https://snip.sa/api/urls', {
    originalUrl: 'https://example.com/very-long-url',
    title: 'My First Link'
  }, {
    headers: {
      'Content-Type': 'application/json',
      'X-API-Key': 'your_api_key_here'
    }
  });

  console.log('Short URL:', response.data.data.domain.shortUrl + '/' + response.data.data.url.shortCode);
  ```

  ```python Python theme={null}
  import requests

  response = requests.post(
      'https://snip.sa/api/urls',
      headers={
          'Content-Type': 'application/json',
          'X-API-Key': 'your_api_key_here'
      },
      json={
          'originalUrl': 'https://example.com/very-long-url',
          'title': 'My First Link'
      }
  )

  data = response.json()
  short_url = f"{data['data']['domain']['shortUrl']}/{data['data']['url']['shortCode']}"
  print(f'Short URL: {short_url}')
  ```

  ```php PHP theme={null}
  <?php
  $apiKey = 'your_api_key_here';

  $ch = curl_init('https://snip.sa/api/urls');
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  curl_setopt($ch, CURLOPT_POST, true);
  curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
      'originalUrl' => 'https://example.com/very-long-url',
      'title' => 'My First Link'
  ]));
  curl_setopt($ch, CURLOPT_HTTPHEADER, [
      'Content-Type: application/json',
      "X-API-Key: $apiKey"
  ]);

  $response = curl_exec($ch);
  curl_close($ch);

  $data = json_decode($response, true);
  $shortUrl = $data['data']['domain']['shortUrl'] . '/' . $data['data']['url']['shortCode'];
  echo "Short URL: $shortUrl\n";
  ?>
  ```
</CodeGroup>

## Response

You'll receive a response like this:

```json theme={null}
{
  "success": true,
  "message": "URL created successfully",
  "data": {
    "url": {
      "_id": "507f1f77bcf86cd799439011",
      "originalUrl": "https://example.com/very-long-url",
      "shortCode": "abc123",
      "title": "My First Link",
      "clickCount": 0,
      "isActive": true,
      "createdAt": "2024-01-15T10:30:00.000Z"
    },
    "domain": {
      "id": "base",
      "fullDomain": "laghhu.link",
      "shortUrl": "https://laghhu.link",
      "isSystemDomain": true
    }
  }
}
```

Your shortened URL is: `https://laghhu.link/abc123`

## Next Steps

<CardGroup cols={2}>
  <Card title="Create Custom Short Codes" icon="pen" href="/api-reference/urls/create">
    Learn how to create custom branded short codes
  </Card>

  <Card title="Track Analytics" icon="chart-line" href="/api-reference/analytics/overview">
    Monitor clicks and user behavior
  </Card>

  <Card title="Add Custom Domains" icon="globe" href="/guides/custom-domains">
    Use your own domain for shortened URLs
  </Card>

  <Card title="Generate QR Codes" icon="qrcode" href="/api-reference/qr-codes/generate">
    Create QR codes for your links
  </Card>
</CardGroup>
