> ## Documentation Index
> Fetch the complete documentation index at: https://www.dropfans.io/developers/llms.txt
> Use this file to discover all available pages before exploring further.

# POST /api/external/links — Create a link for a drop, a tip, a subscription or the profile

> Creates one link id. The link is `https://www.dropfans.io/buy/{id}` (web) and `https://t.me/<bot>/app?startapp={id}` (Telegram), with no parameters. The drop, the tip amount and your `externalRef` are stored with the id.

- Source: https://www.dropfans.io/developers/reference/create-link
- Section: API reference
- OpenAPI: https://www.dropfans.io/developers/openapi.json

Creates one link id. The link is `https://www.dropfans.io/buy/{id}` (web) and `https://t.me/<bot>/app?startapp={id}` (Telegram), with no parameters. The drop, the tip amount and your `externalRef` are stored with the id.

- `buy`: a drop (`productId` from create-drop) opens its checkout. A subscriber-only drop opens the subscribe sheet instead.
- `tip`: opens the tip sheet, prefilled with `amountUsd` when you set one ($5–$750), or the fan picks.
- `subscribe`: opens the subscribe sheet. `profile` opens the profile.

`externalRef` (1–32 of `A-Z a-z 0-9 _ -`) comes back on the sale: the `drop.paid` / `tip.paid` webhooks and GET /orders and /tips, together with the link's `linkId`. One link per fan per drop is the usual pattern.

The same request always returns the same link, so it's safe to call again. With a key that belongs to an app, sales through the link earn your app owner commission for life, and the call makes your app the account's connected CRM.

## Authentication

`Authorization: Bearer dpfn_...` — an API key generated in the dashboard (Vault → API Connect). By default the key acts for the one account it belongs to. Missing or invalid keys return 401 `{"error":"Unauthorized","code":"unauthorized"}`.

Optional `X-Dropfans-Account: <account id>` — with a verified agency's own key, act for a creator or AI persona the agency manages (ids from GET /api/external/agency/creators). The response echoes the account acted on in the same header.

## Request body (application/json)

| Field | Type | Required | Description |
|---|---|---|---|
| `type` | `buy` \\| `tip` \\| `subscribe` \\| `profile` | yes | What the link opens. |
| `productId` | string |  | The drop, for `buy` (required there, refused otherwise). Must belong to the account. |
| `amountUsd` | number |  | Fixed tip amount for `tip` ($5–$750). Omit to let the fan pick. |
| `externalRef` | string |  | Your per-fan reference, returned on the sale. |

Example — One drop, one fan:

```json
{
  "type": "buy",
  "productId": "cmv5tmpcm0015h4oucxkgc4ma",
  "externalRef": "tg_48213377"
}
```

Example — A $20 tip link:

```json
{
  "type": "tip",
  "amountUsd": 20,
  "externalRef": "tg_48213377"
}
```

## Responses

### 200

The link (new, or the existing one for this exact request).

| Field | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | The link id (10 of `a-z 0-9`). Comes back as `linkId` on sales through the link. |
| `type` | `buy` \\| `tip` \\| `subscribe` \\| `profile` | yes | What the link opens. |
| `url` | string | yes | The web link — `/buy/{id}`, no parameters. |
| `telegram` | string \\| null |  | The Telegram Mini App link (`startapp={id}`). Null when the shared Dropfans bot is not configured. |
| `productId` | string \\| null |  | The drop of a `buy` link. |
| `amountUsd` | number \\| null |  | Fixed amount of a `tip` link; null = the fan picks. |
| `externalRef` | string \\| null |  | Your per-fan reference, returned on the sale. |
| `createdAt` | string | yes | When the link was created. |

```json
{
  "id": "q7m2c8zk4w",
  "type": "buy",
  "url": "https://www.dropfans.io/buy/q7m2c8zk4w",
  "telegram": "https://t.me/DropfansBot/app?startapp=q7m2c8zk4w",
  "productId": "cmv5tmpcm0015h4oucxkgc4ma",
  "amountUsd": null,
  "externalRef": "tg_48213377",
  "createdAt": "2026-10-29T12:00:00.000Z"
}
```

## Errors

| Status | Body | When |
|---|---|---|
| 400 | `{"error":"type must be one of profile, tip, subscribe, buy","code":"invalid_type"}` | Unknown `type`. Also `invalid_external_ref`, `invalid_amount` (out of range, or not a tip) and `invalid_product` (productId on a non-buy link). |
| 404 | `{"error":"Drop not found","code":"product_not_found"}` | `productId` is missing, unknown or another account’s. |
| 409 | `{"error":"Set a username first","code":"username_required"}` | The creator has no username yet. |
| 400 | `{"error":"X-Dropfans-Account must be an account id (from GET /api/external/agency/creators), not a username.","code":"invalid_account_header"}` | `X-Dropfans-Account` is not an account id. |
| 403 | `{"error":"This key cannot act for that account.","code":"account_not_managed"}` | `X-Dropfans-Account` names an account this key cannot act for: not an agency’s own key, no ACCEPTED management, or the agency or account is suspended, banned or deleted (an unknown id gets the same answer). |

## Rate limiting

Per-key fixed windows by tier (Personal 60/min · 5,000/day; approved apps 300/min · 50,000/day; Dropfans-operated integrations exempt). Read the live values from X-RateLimit-Tier, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset and their -Day variants; a 429 carries Retry-After and `{"error":"Rate limit exceeded","code":"rate_limited"}`. See [Rate limits](https://www.dropfans.io/developers/concepts/rate-limits.md).

## Code samples

### curl

```bash
curl -X POST "https://www.dropfans.io/api/external/links" \
  -H "Authorization: Bearer $DROPFANS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "type": "buy",
  "productId": "cmv5tmpcm0015h4oucxkgc4ma",
  "externalRef": "tg_48213377"
}'
```

### Node

```javascript
const res = await fetch(`https://www.dropfans.io/api/external/links`, {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.DROPFANS_API_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "type": "buy",
    "productId": "cmv5tmpcm0015h4oucxkgc4ma",
    "externalRef": "tg_48213377"
  }),
});
console.log(await res.json());
```

### Python

```python
import os
import requests

res = requests.post(
    "https://www.dropfans.io/api/external/links",
    headers={"Authorization": f"Bearer {os.environ['DROPFANS_API_KEY']}"},
    json={
        "type": "buy",
        "productId": "cmv5tmpcm0015h4oucxkgc4ma",
        "externalRef": "tg_48213377",
    },
)
print(res.json())
```

## OpenAPI

```json
{
  "method": "POST",
  "path": "/api/external/links",
  "operationId": "createLink",
  "tags": [
    "links"
  ],
  "summary": "Create a link for a drop, a tip, a subscription or the profile",
  "description": "Creates one link id. The link is `https://www.dropfans.io/buy/{id}` (web) and `https://t.me/<bot>/app?startapp={id}` (Telegram), with no parameters. The drop, the tip amount and your `externalRef` are stored with the id.\n\n- `buy`: a drop (`productId` from create-drop) opens its checkout. A subscriber-only drop opens the subscribe sheet instead.\n- `tip`: opens the tip sheet, prefilled with `amountUsd` when you set one ($5–$750), or the fan picks.\n- `subscribe`: opens the subscribe sheet. `profile` opens the profile.\n\n`externalRef` (1–32 of `A-Z a-z 0-9 _ -`) comes back on the sale: the `drop.paid` / `tip.paid` webhooks and GET /orders and /tips, together with the link's `linkId`. One link per fan per drop is the usual pattern.\n\nThe same request always returns the same link, so it's safe to call again. With a key that belongs to an app, sales through the link earn your app owner commission for life, and the call makes your app the account's connected CRM.",
  "parameters": [
    {
      "name": "X-Dropfans-Account",
      "in": "header",
      "required": false,
      "description": "Agencies only. With a verified agency’s own key, the id of a creator or AI persona the agency manages (from GET /api/external/agency/creators): the request then acts as that account, exactly as if it were sent with that account’s own key. Account ids only — usernames are refused (400 invalid_account_header). Checked on every request: the management must be ACCEPTED, nobody may be suspended, banned or deleted (else 403 account_not_managed), and the agency needs the endpoint’s permission on that account (else 403 permission_denied). Omit it to act as the key’s own account.",
      "schema": {
        "type": "string",
        "pattern": "^c[a-z0-9]{20,32}$"
      },
      "example": "cmh4v2q8k0003xy9z7w6v5u4t"
    }
  ],
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "type": "object",
          "properties": {
            "type": {
              "type": "string",
              "description": "What the link opens.",
              "enum": [
                "buy",
                "tip",
                "subscribe",
                "profile"
              ]
            },
            "productId": {
              "type": "string",
              "description": "The drop, for `buy` (required there, refused otherwise). Must belong to the account."
            },
            "amountUsd": {
              "type": "number",
              "description": "Fixed tip amount for `tip` ($5–$750). Omit to let the fan pick."
            },
            "externalRef": {
              "type": "string",
              "description": "Your per-fan reference, returned on the sale.",
              "maxLength": 32,
              "pattern": "^[A-Za-z0-9_-]{1,32}$"
            }
          },
          "required": [
            "type"
          ]
        },
        "examples": {
          "buy": {
            "summary": "One drop, one fan",
            "value": {
              "type": "buy",
              "productId": "cmv5tmpcm0015h4oucxkgc4ma",
              "externalRef": "tg_48213377"
            }
          },
          "tip": {
            "summary": "A $20 tip link",
            "value": {
              "type": "tip",
              "amountUsd": 20,
              "externalRef": "tg_48213377"
            }
          }
        }
      }
    }
  },
  "responses": {
    "200": {
      "description": "The link (new, or the existing one for this exact request).",
      "headers": {
        "X-RateLimit-Tier": {
          "description": "Rate-limit tier of the key: personal, app or first_party (first_party is unlimited).",
          "schema": {
            "type": "string",
            "enum": [
              "personal",
              "app",
              "first_party"
            ]
          }
        },
        "X-RateLimit-Limit": {
          "description": "Requests allowed per minute for this key (absent on first_party).",
          "schema": {
            "type": "integer"
          }
        },
        "X-RateLimit-Remaining": {
          "description": "Requests left in the current minute window.",
          "schema": {
            "type": "integer"
          }
        },
        "X-RateLimit-Reset": {
          "description": "Epoch seconds when the minute window resets.",
          "schema": {
            "type": "integer"
          }
        },
        "X-RateLimit-Limit-Day": {
          "description": "Requests allowed per UTC day for this key (absent on first_party).",
          "schema": {
            "type": "integer"
          }
        },
        "X-RateLimit-Remaining-Day": {
          "description": "Requests left in the current UTC day window.",
          "schema": {
            "type": "integer"
          }
        },
        "X-RateLimit-Reset-Day": {
          "description": "Epoch seconds when the day window resets.",
          "schema": {
            "type": "integer"
          }
        },
        "X-Dropfans-Account": {
          "description": "The id of the account this request acted on — the key’s own account, or the managed account named in the X-Dropfans-Account request header. Assert it when acting for several accounts.",
          "schema": {
            "type": "string"
          }
        }
      },
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "description": "The link id (10 of `a-z 0-9`). Comes back as `linkId` on sales through the link.",
                "example": "q7m2c8zk4w"
              },
              "type": {
                "type": "string",
                "description": "What the link opens.",
                "enum": [
                  "buy",
                  "tip",
                  "subscribe",
                  "profile"
                ],
                "example": "buy"
              },
              "url": {
                "type": "string",
                "description": "The web link — `/buy/{id}`, no parameters.",
                "format": "uri",
                "example": "https://www.dropfans.io/buy/q7m2c8zk4w"
              },
              "telegram": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "The Telegram Mini App link (`startapp={id}`). Null when the shared Dropfans bot is not configured.",
                "format": "uri",
                "example": "https://t.me/DropfansBot/app?startapp=q7m2c8zk4w"
              },
              "productId": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "The drop of a `buy` link.",
                "example": "cmv5tmpcm0015h4oucxkgc4ma"
              },
              "amountUsd": {
                "type": [
                  "number",
                  "null"
                ],
                "description": "Fixed amount of a `tip` link; null = the fan picks.",
                "example": null
              },
              "externalRef": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Your per-fan reference, returned on the sale.",
                "example": "tg_48213377"
              },
              "createdAt": {
                "type": "string",
                "description": "When the link was created.",
                "format": "date-time",
                "example": "2026-10-29T12:00:00.000Z"
              }
            },
            "required": [
              "id",
              "type",
              "url",
              "createdAt"
            ]
          },
          "example": {
            "id": "q7m2c8zk4w",
            "type": "buy",
            "url": "https://www.dropfans.io/buy/q7m2c8zk4w",
            "telegram": "https://t.me/DropfansBot/app?startapp=q7m2c8zk4w",
            "productId": "cmv5tmpcm0015h4oucxkgc4ma",
            "amountUsd": null,
            "externalRef": "tg_48213377",
            "createdAt": "2026-10-29T12:00:00.000Z"
          }
        }
      }
    },
    "400": {
      "description": "Unknown `type`. Also `invalid_external_ref`, `invalid_amount` (out of range, or not a tip) and `invalid_product` (productId on a non-buy link). Also: `X-Dropfans-Account` is not an account id.",
      "headers": {
        "X-RateLimit-Tier": {
          "description": "Rate-limit tier of the key: personal, app or first_party (first_party is unlimited).",
          "schema": {
            "type": "string",
            "enum": [
              "personal",
              "app",
              "first_party"
            ]
          }
        },
        "X-RateLimit-Limit": {
          "description": "Requests allowed per minute for this key (absent on first_party).",
          "schema": {
            "type": "integer"
          }
        },
        "X-RateLimit-Remaining": {
          "description": "Requests left in the current minute window.",
          "schema": {
            "type": "integer"
          }
        },
        "X-RateLimit-Reset": {
          "description": "Epoch seconds when the minute window resets.",
          "schema": {
            "type": "integer"
          }
        },
        "X-RateLimit-Limit-Day": {
          "description": "Requests allowed per UTC day for this key (absent on first_party).",
          "schema": {
            "type": "integer"
          }
        },
        "X-RateLimit-Remaining-Day": {
          "description": "Requests left in the current UTC day window.",
          "schema": {
            "type": "integer"
          }
        },
        "X-RateLimit-Reset-Day": {
          "description": "Epoch seconds when the day window resets.",
          "schema": {
            "type": "integer"
          }
        }
      },
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "Human-readable message.",
                "example": "Rate limit exceeded"
              },
              "code": {
                "type": "string",
                "description": "Machine-readable code: unauthorized, app_suspended, first_party_only, rate_limited, username_required, invalid_account_header, account_not_managed, permission_denied, account_header_not_allowed, agency_key_required — plus endpoint-specific codes listed on each reference page.",
                "example": "rate_limited"
              }
            },
            "required": [
              "error",
              "code"
            ]
          },
          "example": {
            "error": "type must be one of profile, tip, subscribe, buy",
            "code": "invalid_type"
          }
        }
      }
    },
    "401": {
      "description": "Missing or invalid API key.",
      "headers": {
        "X-RateLimit-Tier": {
          "description": "Rate-limit tier of the key: personal, app or first_party (first_party is unlimited).",
          "schema": {
            "type": "string",
            "enum": [
              "personal",
              "app",
              "first_party"
            ]
          }
        }
      },
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "Human-readable message.",
                "example": "Rate limit exceeded"
              },
              "code": {
                "type": "string",
                "description": "Machine-readable code: unauthorized, app_suspended, first_party_only, rate_limited, username_required, invalid_account_header, account_not_managed, permission_denied, account_header_not_allowed, agency_key_required — plus endpoint-specific codes listed on each reference page.",
                "example": "rate_limited"
              }
            },
            "required": [
              "error",
              "code"
            ]
          },
          "example": {
            "error": "Unauthorized",
            "code": "unauthorized"
          }
        }
      }
    },
    "403": {
      "description": "`X-Dropfans-Account` names an account this key cannot act for: not an agency’s own key, no ACCEPTED management, or the agency or account is suspended, banned or deleted (an unknown id gets the same answer).",
      "headers": {
        "X-RateLimit-Tier": {
          "description": "Rate-limit tier of the key: personal, app or first_party (first_party is unlimited).",
          "schema": {
            "type": "string",
            "enum": [
              "personal",
              "app",
              "first_party"
            ]
          }
        },
        "X-RateLimit-Limit": {
          "description": "Requests allowed per minute for this key (absent on first_party).",
          "schema": {
            "type": "integer"
          }
        },
        "X-RateLimit-Remaining": {
          "description": "Requests left in the current minute window.",
          "schema": {
            "type": "integer"
          }
        },
        "X-RateLimit-Reset": {
          "description": "Epoch seconds when the minute window resets.",
          "schema": {
            "type": "integer"
          }
        },
        "X-RateLimit-Limit-Day": {
          "description": "Requests allowed per UTC day for this key (absent on first_party).",
          "schema": {
            "type": "integer"
          }
        },
        "X-RateLimit-Remaining-Day": {
          "description": "Requests left in the current UTC day window.",
          "schema": {
            "type": "integer"
          }
        },
        "X-RateLimit-Reset-Day": {
          "description": "Epoch seconds when the day window resets.",
          "schema": {
            "type": "integer"
          }
        }
      },
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "Human-readable message.",
                "example": "Rate limit exceeded"
              },
              "code": {
                "type": "string",
                "description": "Machine-readable code: unauthorized, app_suspended, first_party_only, rate_limited, username_required, invalid_account_header, account_not_managed, permission_denied, account_header_not_allowed, agency_key_required — plus endpoint-specific codes listed on each reference page.",
                "example": "rate_limited"
              }
            },
            "required": [
              "error",
              "code"
            ]
          },
          "example": {
            "error": "This key cannot act for that account.",
            "code": "account_not_managed"
          }
        }
      }
    },
    "404": {
      "description": "`productId` is missing, unknown or another account’s.",
      "headers": {
        "X-RateLimit-Tier": {
          "description": "Rate-limit tier of the key: personal, app or first_party (first_party is unlimited).",
          "schema": {
            "type": "string",
            "enum": [
              "personal",
              "app",
              "first_party"
            ]
          }
        },
        "X-RateLimit-Limit": {
          "description": "Requests allowed per minute for this key (absent on first_party).",
          "schema": {
            "type": "integer"
          }
        },
        "X-RateLimit-Remaining": {
          "description": "Requests left in the current minute window.",
          "schema": {
            "type": "integer"
          }
        },
        "X-RateLimit-Reset": {
          "description": "Epoch seconds when the minute window resets.",
          "schema": {
            "type": "integer"
          }
        },
        "X-RateLimit-Limit-Day": {
          "description": "Requests allowed per UTC day for this key (absent on first_party).",
          "schema": {
            "type": "integer"
          }
        },
        "X-RateLimit-Remaining-Day": {
          "description": "Requests left in the current UTC day window.",
          "schema": {
            "type": "integer"
          }
        },
        "X-RateLimit-Reset-Day": {
          "description": "Epoch seconds when the day window resets.",
          "schema": {
            "type": "integer"
          }
        }
      },
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "Human-readable message.",
                "example": "Rate limit exceeded"
              },
              "code": {
                "type": "string",
                "description": "Machine-readable code: unauthorized, app_suspended, first_party_only, rate_limited, username_required, invalid_account_header, account_not_managed, permission_denied, account_header_not_allowed, agency_key_required — plus endpoint-specific codes listed on each reference page.",
                "example": "rate_limited"
              }
            },
            "required": [
              "error",
              "code"
            ]
          },
          "example": {
            "error": "Drop not found",
            "code": "product_not_found"
          }
        }
      }
    },
    "409": {
      "description": "The creator has no username yet.",
      "headers": {
        "X-RateLimit-Tier": {
          "description": "Rate-limit tier of the key: personal, app or first_party (first_party is unlimited).",
          "schema": {
            "type": "string",
            "enum": [
              "personal",
              "app",
              "first_party"
            ]
          }
        },
        "X-RateLimit-Limit": {
          "description": "Requests allowed per minute for this key (absent on first_party).",
          "schema": {
            "type": "integer"
          }
        },
        "X-RateLimit-Remaining": {
          "description": "Requests left in the current minute window.",
          "schema": {
            "type": "integer"
          }
        },
        "X-RateLimit-Reset": {
          "description": "Epoch seconds when the minute window resets.",
          "schema": {
            "type": "integer"
          }
        },
        "X-RateLimit-Limit-Day": {
          "description": "Requests allowed per UTC day for this key (absent on first_party).",
          "schema": {
            "type": "integer"
          }
        },
        "X-RateLimit-Remaining-Day": {
          "description": "Requests left in the current UTC day window.",
          "schema": {
            "type": "integer"
          }
        },
        "X-RateLimit-Reset-Day": {
          "description": "Epoch seconds when the day window resets.",
          "schema": {
            "type": "integer"
          }
        }
      },
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "Human-readable message.",
                "example": "Rate limit exceeded"
              },
              "code": {
                "type": "string",
                "description": "Machine-readable code: unauthorized, app_suspended, first_party_only, rate_limited, username_required, invalid_account_header, account_not_managed, permission_denied, account_header_not_allowed, agency_key_required — plus endpoint-specific codes listed on each reference page.",
                "example": "rate_limited"
              }
            },
            "required": [
              "error",
              "code"
            ]
          },
          "example": {
            "error": "Set a username first",
            "code": "username_required"
          }
        }
      }
    },
    "429": {
      "description": "Rate limit exceeded for the current minute or day window. Wait Retry-After seconds and retry.",
      "headers": {
        "X-RateLimit-Tier": {
          "description": "Rate-limit tier of the key: personal, app or first_party (first_party is unlimited).",
          "schema": {
            "type": "string",
            "enum": [
              "personal",
              "app",
              "first_party"
            ]
          }
        },
        "X-RateLimit-Limit": {
          "description": "Requests allowed per minute for this key (absent on first_party).",
          "schema": {
            "type": "integer"
          }
        },
        "X-RateLimit-Remaining": {
          "description": "Requests left in the current minute window.",
          "schema": {
            "type": "integer"
          }
        },
        "X-RateLimit-Reset": {
          "description": "Epoch seconds when the minute window resets.",
          "schema": {
            "type": "integer"
          }
        },
        "X-RateLimit-Limit-Day": {
          "description": "Requests allowed per UTC day for this key (absent on first_party).",
          "schema": {
            "type": "integer"
          }
        },
        "X-RateLimit-Remaining-Day": {
          "description": "Requests left in the current UTC day window.",
          "schema": {
            "type": "integer"
          }
        },
        "X-RateLimit-Reset-Day": {
          "description": "Epoch seconds when the day window resets.",
          "schema": {
            "type": "integer"
          }
        },
        "Retry-After": {
          "description": "Seconds to wait before retrying (sent with 429s).",
          "schema": {
            "type": "integer"
          }
        }
      },
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "Human-readable message.",
                "example": "Rate limit exceeded"
              },
              "code": {
                "type": "string",
                "description": "Machine-readable code: unauthorized, app_suspended, first_party_only, rate_limited, username_required, invalid_account_header, account_not_managed, permission_denied, account_header_not_allowed, agency_key_required — plus endpoint-specific codes listed on each reference page.",
                "example": "rate_limited"
              }
            },
            "required": [
              "error",
              "code"
            ]
          },
          "example": {
            "error": "Rate limit exceeded",
            "code": "rate_limited"
          }
        }
      }
    }
  },
  "x-codeSamples": [
    {
      "lang": "cURL",
      "label": "curl",
      "source": "curl -X POST \"https://www.dropfans.io/api/external/links\" \\\n  -H \"Authorization: Bearer $DROPFANS_API_KEY\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n  \"type\": \"buy\",\n  \"productId\": \"cmv5tmpcm0015h4oucxkgc4ma\",\n  \"externalRef\": \"tg_48213377\"\n}'"
    },
    {
      "lang": "JavaScript",
      "label": "Node",
      "source": "const res = await fetch(`https://www.dropfans.io/api/external/links`, {\n  method: 'POST',\n  headers: {\n    Authorization: `Bearer ${process.env.DROPFANS_API_KEY}`,\n    'Content-Type': 'application/json',\n  },\n  body: JSON.stringify({\n    \"type\": \"buy\",\n    \"productId\": \"cmv5tmpcm0015h4oucxkgc4ma\",\n    \"externalRef\": \"tg_48213377\"\n  }),\n});\nconsole.log(await res.json());"
    },
    {
      "lang": "Python",
      "source": "import os\nimport requests\n\nres = requests.post(\n    \"https://www.dropfans.io/api/external/links\",\n    headers={\"Authorization\": f\"Bearer {os.environ['DROPFANS_API_KEY']}\"},\n    json={\n        \"type\": \"buy\",\n        \"productId\": \"cmv5tmpcm0015h4oucxkgc4ma\",\n        \"externalRef\": \"tg_48213377\",\n    },\n)\nprint(res.json())"
    }
  ],
  "x-dropfans-docs": "https://www.dropfans.io/developers/reference/create-link",
  "x-dropfans-agency-permission": null
}
```

---

Previous: [The creator’s profile, tip and subscribe links](https://www.dropfans.io/developers/reference/get-links.md) · Next: [Read the Telegram notification status](https://www.dropfans.io/developers/reference/get-notifications.md) · All pages: [llms.txt](https://www.dropfans.io/developers/llms.txt)
