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

# Get Affiliate Link(s)

> Returns affiliate links for your program, each enriched with its click, referral and sale counts, the revenue it has generated, and a ready-to-share full URL for every base URL configured on your program.

Filter by `id` or `link` for one link, or by `affiliateId` / `affiliateEmail` for every link an affiliate owns. With no parameters, every link in the program is returned.

This endpoint always returns an array. A filter that matches nothing returns `[]`.



## OpenAPI

````yaml GET /links
openapi: 3.0.1
info:
  title: Referly API
  description: >-
    REST API for managing affiliates, referrals, sales, affiliate links, coupons
    and promotional codes in your Referly affiliate program.


    Every request must send `Authorization: Bearer <YOUR_API_KEY>`. The token is
    scoped to a single affiliate program, so no program ID is ever required in
    the request — every read and write is automatically limited to that program.


    Requests are rate limited per token, per endpoint and per method.
  version: 1.0.0
servers:
  - url: https://www.referly.so/api/v1
security:
  - bearerAuth: []
paths:
  /links:
    get:
      summary: Get affiliate link(s)
      description: >-
        Returns affiliate links for your program, each enriched with its click,
        referral and sale counts, the revenue it has generated, and a
        ready-to-share full URL for every base URL configured on your program.


        Filter by `id` or `link` for one link, or by `affiliateId` /
        `affiliateEmail` for every link an affiliate owns. With no parameters,
        every link in the program is returned.


        This endpoint always returns an array. A filter that matches nothing
        returns `[]`.
      parameters:
        - name: id
          in: query
          description: The affiliate link's UUID.
          schema:
            type: string
            format: uuid
        - name: link
          in: query
          description: The link slug, for example `jane-doe`.
          schema:
            type: string
        - name: affiliateId
          in: query
          description: Return every link owned by this affiliate UUID.
          schema:
            type: string
            format: uuid
        - name: affiliateEmail
          in: query
          description: Return every link owned by the affiliate with this email address.
          schema:
            type: string
            format: email
      responses:
        '200':
          description: The matching affiliate links. Empty when nothing matched.
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/AffiliateLink'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/ProgramNotFound'
        '429':
          $ref: '#/components/responses/RateLimited'
        '500':
          description: The affiliate links could not be fetched.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    AffiliateLink:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: The affiliate link ID
        link:
          type: string
          description: The affiliate link string
        createdAt:
          type: string
          format: date-time
          description: Timestamp when the affiliate link was created
        updatedAt:
          type: string
          format: date-time
          description: Timestamp when the affiliate link was last updated
        affiliate:
          type: object
          properties:
            id:
              type: string
              format: uuid
              description: The affiliate ID
            name:
              type: string
              description: Full name of the affiliate
            email:
              type: string
              format: email
              description: Email of the affiliate
          nullable: true
          description: The affiliate who owns this link. `null` if the link has no owner.
        program:
          type: object
          properties:
            id:
              type: string
              format: uuid
              description: The program ID
            name:
              type: string
              description: Name of the affiliate program
            currency:
              type: string
              description: Currency used by the program
          nullable: true
          description: The program this link belongs to. `null` if the link has no program.
        clicks:
          type: integer
          description: Number of clicks on this affiliate link
        referrals:
          type: integer
          description: Number of referrals generated by this link
        sales:
          type: integer
          description: Number of sales generated by this link
        totalRevenue:
          type: number
          format: float
          description: Sum of `totalEarned` across every sale attributed to this link
        fullURLs:
          type: array
          description: >-
            One entry per base URL configured on your program, with the
            affiliate's tracking parameter and any program URL parameters
            already applied. Share these directly.
          items:
            type: object
            properties:
              baseUrl:
                type: string
                description: The base URL
              fullUrl:
                type: string
                description: The complete affiliate URL with parameters
      description: >-
        An affiliate link as returned by the affiliate link endpoints. The
        counters and `fullURLs` are computed per request and are not stored on
        the link itself.
    Error:
      type: object
      properties:
        error:
          type: string
          description: Human readable description of what went wrong
  responses:
    Unauthorized:
      description: >-
        The `Authorization` header is missing, is not a `Bearer` header, or the
        token is not valid.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Forbidden:
      description: API access is not enabled for this account.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    ProgramNotFound:
      description: The affiliate program this token belongs to no longer exists.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    RateLimited:
      description: Too many requests for this token on this endpoint. Please slow down.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````