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

# Introduction

> Programmatically manage links, resources, and analytics with the ShortPen API.

## Overview

ShortPen's REST API exposes the same capabilities that power the dashboard. Use it to:

* generate branded links and QR codes from automations or backend jobs,
* sync domains, folders, pixels, and workspaces into your internal tools, and
* export click analytics for reporting, BI, or attribution.

All requests are scoped to the organization and workspace attached to your API key, and they inherit the same feature limits you configured in the product.

## Base URL

```text theme={null}
https://api.shortpen.com
```

## Authentication

<Steps>
  <Step title="Create an API key" titleSize="h3">
    In the app, open **Settings → Organization → API Keys** and click **+ Create API key**. Give the key a name so you can identify it later.
  </Step>

  <Step title="Store the secret securely" titleSize="h3">
    Copy the generated value immediately—it is only shown once. Save it in your secrets manager, CI/CD vault, or password manager.
  </Step>

  <Step title="Send bearer tokens with every request" titleSize="h3">
    Include the key in the `Authorization` header using the `Bearer` scheme. Tokens inherit the plan limits and workspace visibility of the creator.
  </Step>
</Steps>

## Make your first request

<CodeGroup>
  ```bash theme={null}
  curl https://api.shortpen.com/v1/ping
  ```

  ```bash theme={null}
  curl -X POST https://api.shortpen.com/v1/me -H "Authorization: Bearer $SHORTPEN_API_KEY" -H "Content-Type: application/json"
  ```
</CodeGroup>

## Common headers

* `Authorization: Bearer <api-key>`
* `Content-Type: application/json`
* `Accept: application/json`

## Rate limits

* Global API limit: 60 requests per minute per access token.
* `GET /v1/ping` also enforces `throttle`, capping the endpoint at 30 requests per minute per IP.
* Feature-specific quotas (for example monthly links or QR codes) return HTTP 429 with a descriptive message once exhausted.

## Response envelope

Every JSON endpoint responds with the same envelope:

```json theme={null}
{
  "success": true,
  "status_code": 200,
  "data": {},
  "message": ""
}
```

`data` varies per operation—see the endpoint pages below for full schemas. Errors return the same structure with `success: false`, `status_code` mirroring the HTTP status, and a human-readable `message`.

## Next steps

<CardGroup cols={2}>
  <Card title="Check API availability" icon="heartbeat" href="/api-reference/endpoint/ping">
    Call the health check endpoint to verify DNS, TLS, and routing.
  </Card>

  <Card title="Pull your profile" icon="id-badge" href="/api-reference/endpoint/me">
    Inspect enabled features, limits, and the workspace automatically selected for your token.
  </Card>

  <Card title="Create links" icon="link" href="/api-reference/endpoint/generate">
    Generate links, QR codes, and tracked campaigns directly from your systems.
  </Card>

  <Card title="Edit links" icon="pen-to-square" href="/api-reference/endpoint/edit-link">
    Update an existing link's destination, slug, tracking, or any other property.
  </Card>

  <Card title="Delete links" icon="trash" href="/api-reference/endpoint/delete-link">
    Remove one or more links by ID. Deletions are soft, so analytics stay recoverable.
  </Card>

  <Card title="List links" icon="list" href="/api-reference/endpoint/list-links">
    Retrieve a paginated list of all links in your workspace.
  </Card>

  <Card title="Sync resources" icon="database" href="/api-reference/endpoint/get-resources">
    Fetch domains, folders, pixels, or organization metadata for your integrations.
  </Card>

  <Card title="Stream analytics" icon="chart-line" href="/api-reference/endpoint/analytics">
    Export click events for BI, attribution, and marketing dashboards.
  </Card>
</CardGroup>
