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

# Create an attribution Amazon link

> Create an Amazon attribution link for either a product or a storefront page.

### Product links
Pass `asin`, `link_name`, and optionally `marketplace`. The marketplace defaults
to `amazon.com`.

### Storefront links
First call `GET /storefront_links` with a `brand_id` or exact `brand_name`.
Choose a returned row and pass both its `brand_id` and `store_page_id` here,
together with `link_name`. Store page IDs are scoped to a brand, so `brand_id`
is required for storefront generation. The storefront page determines the
marketplace. Requests that explicitly include both `store_page_id` and
`marketplace` are rejected.

Provide exactly one of `asin` or `store_page_id`. In the response, `url` is the
canonical shareable attribution URL; `attribution_link` mirrors it for legacy
clients. The response `id` identifies the generated link for reporting.

### Naming your link
`link_name` is for your own bookkeeping and appears in `/reports` and
`/get_all_links`.

### When things go wrong
- **Destination not found** - the ASIN or storefront id is unavailable.
- **Brand disabled the storefront** - choose a product link or another brand.
- **Could not reach Amazon** - retry after a short delay.



## OpenAPI

````yaml /docs/api-reference/openapi.json post /generate_attribution_link
openapi: 3.1.0
info:
  title: Archer Affiliates API
  description: API that allows use of features on the Archer Platform
  version: '2.0'
servers:
  - url: https://api.archeraffiliates.com
    description: Production
security: []
paths:
  /generate_attribution_link:
    post:
      tags:
        - Attribution Links
      summary: Create an attribution Amazon link
      description: >-
        Create an Amazon attribution link for either a product or a storefront
        page.


        ### Product links

        Pass `asin`, `link_name`, and optionally `marketplace`. The marketplace
        defaults

        to `amazon.com`.


        ### Storefront links

        First call `GET /storefront_links` with a `brand_id` or exact
        `brand_name`.

        Choose a returned row and pass both its `brand_id` and `store_page_id`
        here,

        together with `link_name`. Store page IDs are scoped to a brand, so
        `brand_id`

        is required for storefront generation. The storefront page determines
        the

        marketplace. Requests that explicitly include both `store_page_id` and

        `marketplace` are rejected.


        Provide exactly one of `asin` or `store_page_id`. In the response, `url`
        is the

        canonical shareable attribution URL; `attribution_link` mirrors it for
        legacy

        clients. The response `id` identifies the generated link for reporting.


        ### Naming your link

        `link_name` is for your own bookkeeping and appears in `/reports` and

        `/get_all_links`.


        ### When things go wrong

        - **Destination not found** - the ASIN or storefront id is unavailable.

        - **Brand disabled the storefront** - choose a product link or another
        brand.

        - **Could not reach Amazon** - retry after a short delay.
      operationId: generate_link_generate_attribution_link_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/attribution_link_creation'
        required: true
      responses:
        '201':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AttributionLinkResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - OAuth2PasswordBearer: []
components:
  schemas:
    attribution_link_creation:
      properties:
        asin:
          anyOf:
            - type: string
            - type: 'null'
          title: Asin
          description: >-
            The Amazon product identifier you want to link to. Required for
            product links and mutually exclusive with `store_page_id`.
          examples:
            - B0D45KS7QM
        store_page_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Store Page Id
          description: >-
            Brand-scoped storefront page identifier returned by `GET
            /storefront_links`. Requires `brand_id` and is mutually exclusive
            with `asin`.
          examples:
            - PAGE-1
        brand_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Brand Id
          description: >-
            Brand identifier from the same `GET /storefront_links` row. Required
            with `store_page_id` because page identifiers are not globally
            unique.
          examples:
            - 65f0f0f0f0f0f0f0f0f0f001
        link_name:
          type: string
          title: Link Name
          description: >-
            A name for the link — used so you can tell it apart from your other
            links in reports.
          examples:
            - spring-2026-yt-campaign
        marketplace:
          anyOf:
            - type: string
            - type: 'null'
          title: Marketplace
          description: >-
            Product links only: the destination marketplace, defaulting to
            `amazon.com`. Do not send this field with `store_page_id`;
            storefront requests derive the marketplace from the page and reject
            an explicitly supplied marketplace.
          default: amazon.com
          examples:
            - amazon.com
            - amazon.co.uk
            - amazon.de
            - amazon.fr
      type: object
      required:
        - link_name
      title: attribution_link_creation
      description: Inputs for creating an attribution Amazon link.
    AttributionLinkResponse:
      properties:
        url:
          type: string
          title: Url
          description: >-
            The canonical attribution Amazon URL — share this anywhere shoppers
            will click it.
        attribution_link:
          type: string
          title: Attribution Link
          description: >-
            Same value as `url`. Kept for older integrations that already read
            this field.
        id:
          anyOf:
            - type: string
            - type: 'null'
          title: Id
          description: >-
            The link's identifier on the Archer platform. Use it to look up
            performance in `/reports`.
        asin:
          anyOf:
            - type: string
            - type: 'null'
          title: Asin
          description: The product the link points at; null for storefront links.
        marketplace:
          type: string
          title: Marketplace
          description: The Amazon marketplace the link sends shoppers to.
        type:
          type: string
          title: Type
          description: 'What the link points to: `product` or `storefront`.'
          default: product
        active:
          type: boolean
          title: Active
          description: False if you later pause reporting for this link.
          default: true
        store_page_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Store Page Id
          description: >-
            The storefront page identifier used to create this link; null for
            product links.
        page_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Page Name
        page_url:
          anyOf:
            - type: string
            - type: 'null'
          title: Page Url
      type: object
      required:
        - url
        - attribution_link
        - marketplace
      title: AttributionLinkResponse
      description: The newly created attribution link.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    OAuth2PasswordBearer:
      type: oauth2
      flows:
        password:
          scopes: {}
          tokenUrl: token

````