---
title: "Create a link"
method: POST
path: "/v1/links"
tags: ["Links"]
---

# Create a link

`POST /v1/links`

## Request

- Base URL: `https://api.affiliaterail.com`
- URL: `https://api.affiliaterail.com/v1/links`
- Auth: HTTP bearer

A destination plus a tracking value. The value defaults to the partner's handle; a custom value must be unique in the program.

**Scope:** `partners:write` (or `write`)

## Request body

- LinkCreate
  - `program_id` string, required: Prefixed id (`prg_…`)
  - `partner_id` string, required: Prefixed id (`part_…`)
  - `destination_url` string, uri, required
  - `value` string: The tracking value; defaults to the partner's handle
  - `param` string
  - `label` string

## Response `201`

The new link

- Link
  - `id` string, required: Prefixed id (`lnk_…`)
  - `object` 'link', required
  - `partner_id` string, required: Prefixed id (`part_…`)
  - `param` string, required
  - `value` string, required
  - `destination_url` string, required
  - `url` string, required: The destination with the tracking parameter applied
  - `short_url` string, nullable, required
  - `short_slug` string, nullable, required
  - `short_domain` string, nullable, required
  - `label` string, nullable, required
  - `rate_override` unknown
  - `stats` object
    - `clicks` integer, required
    - `referrals` integer, required
    - `customers` integer, required
  - `created_at` string, date-time, required: ISO-8601, UTC
  - `updated_at` string, date-time, required: ISO-8601, UTC

## Other responses

- `400`: Invalid request
- `401`: Missing or unknown API key
- `403`: Key lacks the required scope
- `404`: No such object in your organization
- `422`: The request was understood and refused
- `429`: Rate limited: see Retry-After

---

[API](https://skmtc.dev/affiliaterail/apis/affiliaterail-api.md) · [All operations](https://skmtc.dev/affiliaterail/apis/affiliaterail-api/llms.txt) · [OpenAPI document](https://skmtc.dev/affiliaterail/apis/affiliaterail-api/revisions/ea41f345c092?raw)
