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

# Bulk Create Links

> Create up to 100 short links in a single request

## Request

### Headers

<ParamField header="Content-Type" type="string" required>
  Must be `application/json`
</ParamField>

### Body

<ParamField body="links" type="array" required>
  Array of link objects to create (max: 100)

  Each link object can contain the same fields as the single create endpoint:

  * `url` (required) - Destination URL
  * `slug` (optional) - Custom slug
  * `title` (optional) - Link title
  * `description` (optional) - Link description
  * `tags` (optional) - Array of tags
  * `domain` (optional) - Custom domain
</ParamField>

## Response

<ResponseField name="created" type="array">
  Array of successfully created link objects
</ResponseField>

<ResponseField name="failed" type="array">
  Array of failed link attempts with error details

  <Expandable title="properties">
    <ResponseField name="index" type="integer">
      Array index of the failed link
    </ResponseField>

    <ResponseField name="slug" type="string">
      The slug that failed (if provided)
    </ResponseField>

    <ResponseField name="error" type="object">
      Error details with `code` and `message`
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="summary" type="object">
  Summary counts

  <Expandable title="properties">
    <ResponseField name="total" type="integer">
      Total number of links attempted
    </ResponseField>

    <ResponseField name="succeeded" type="integer">
      Number of successfully created links
    </ResponseField>

    <ResponseField name="failed" type="integer">
      Number of failed links
    </ResponseField>
  </Expandable>
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST https://api.bouncy.ai/v1/links/bulk \
    -H "Authorization: Bearer bcy_live_pk_YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "links": [
        {
          "url": "https://example.com/page1",
          "slug": "page1",
          "title": "Page 1",
          "tags": ["bulk", "test"]
        },
        {
          "url": "https://example.com/page2",
          "slug": "page2",
          "title": "Page 2",
          "tags": ["bulk", "test"]
        },
        {
          "url": "https://example.com/page3",
          "slug": "page3",
          "title": "Page 3",
          "tags": ["bulk", "test"]
        }
      ]
    }'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch('https://api.bouncy.ai/v1/links/bulk', {
    method: 'POST',
    headers: {
      'Authorization': 'Bearer bcy_live_pk_YOUR_API_KEY',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      links: [
        {
          url: 'https://example.com/page1',
          slug: 'page1',
          title: 'Page 1',
          tags: ['bulk', 'test']
        },
        {
          url: 'https://example.com/page2',
          slug: 'page2',
          title: 'Page 2',
          tags: ['bulk', 'test']
        },
        {
          url: 'https://example.com/page3',
          slug: 'page3',
          title: 'Page 3',
          tags: ['bulk', 'test']
        }
      ]
    })
  });

  const result = await response.json();
  console.log(`Created ${result.summary.succeeded} links, ${result.summary.failed} failed`);
  ```

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

  response = requests.post(
      'https://api.bouncy.ai/v1/links/bulk',
      headers={
          'Authorization': 'Bearer bcy_live_pk_YOUR_API_KEY',
          'Content-Type': 'application/json'
      },
      json={
          'links': [
              {
                  'url': 'https://example.com/page1',
                  'slug': 'page1',
                  'title': 'Page 1',
                  'tags': ['bulk', 'test']
              },
              {
                  'url': 'https://example.com/page2',
                  'slug': 'page2',
                  'title': 'Page 2',
                  'tags': ['bulk', 'test']
              },
              {
                  'url': 'https://example.com/page3',
                  'slug': 'page3',
                  'title': 'Page 3',
                  'tags': ['bulk', 'test']
              }
          ]
      }
  )

  result = response.json()
  print(f"Created {result['summary']['succeeded']} links, {result['summary']['failed']} failed")
  ```
</RequestExample>

<ResponseExample>
  ```json 200 Success theme={null}
  {
    "created": [
      {
        "id": "link_abc123",
        "shortUrl": "https://bouncy.ai/page1",
        "slug": "page1",
        "destination": "https://example.com/page1",
        "title": "Page 1",
        "tags": ["bulk", "test"]
      },
      {
        "id": "link_def456",
        "shortUrl": "https://bouncy.ai/page2",
        "slug": "page2",
        "destination": "https://example.com/page2",
        "title": "Page 2",
        "tags": ["bulk", "test"]
      }
    ],
    "failed": [
      {
        "index": 2,
        "slug": "page3",
        "error": {
          "code": "slug_already_exists",
          "message": "The slug 'page3' is already in use"
        }
      }
    ],
    "summary": {
      "total": 3,
      "succeeded": 2,
      "failed": 1
    }
  }
  ```

  ```json 400 Bad Request theme={null}
  {
    "error": {
      "code": "invalid_request",
      "message": "links array is required"
    }
  }
  ```

  ```json 400 Too Many Links theme={null}
  {
    "error": {
      "code": "too_many_links",
      "message": "Maximum 100 links allowed per request. You provided 150."
    }
  }
  ```
</ResponseExample>
