---
title: "Create Magic Link"
method: POST
path: "/magic-links"
tags: ["Auth"]
---

# Create Magic Link

`POST /magic-links`

Create a Magic Link to allow users to connect their integrations via a temporary link.

## Headers

- `x-trackstar-api-key` string, required

## Request body

- MagicLinkInputSchema
  - `connection_id` string, nullable — An optional existing connection ID. If provided, the connection is reinstalled instead of a new connection being created.
  - `integration_allow_list` string[] — Integrations that your users will be allowed to install. Mutually exclusive with `integration_block_list` and `integrations_with_endpoints`.
  - `integration_block_list` string[] — Integrations that your users will not be allowed to install. Mutually exclusive with `integration_allow_list`.
  - `integrations_with_endpoints` string[] — Only show integrations that support these endpoints. Mutually exclusive with `integration_allow_list`.
  - `integration_type` 'wms' | 'freight' | 'cart' | 'carrier' | 'erp' — The type of integration to filter by.
  - `link_duration` integer — The number of days you want this magic link to be active.
  - `customer_id` string, nullable — An identifier for your end customer.

## Response `200`

Successful response

- MagicLinkResponseSchema
  - `magic_link` MagicLink, required
    - `id` string, required — The magic link ID
    - `url` string, required — The full Magic Link URL to share with your customer
    - `expires_at` string, required — ISO 8601 timestamp when link expires
    - `integration_type` 'wms' | 'freight' | 'cart' | 'carrier' | 'erp', required — Type of integration
    - `integration_allow_list` string[], required — Allowed integrations
    - `integration_block_list` string[], required — Blocked integrations
    - `integrations_with_endpoints` string[], required — Integrations with specific endpoints
    - `customer_id` string, nullable, required — Customer identifier

## Other responses

- `422` — Validation error

---

[API](https://skmtc.net/trackstarhq/apis/trackstar-api.md) · [All operations](https://skmtc.net/trackstarhq/apis/trackstar-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/trackstarhq/trackstar-api/versions/4bc5c6e1a8bf/schema)
