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

# Get Affiliate Link(s)

> Returns a list of affiliate links based on the affiliate program, filtered by optional link ID, link string, affiliate ID, or affiliate email



## OpenAPI

````yaml GET /links
openapi: 3.0.1
info:
  title: Referly API
  description: API for managing affiliates, referrals, and sales for SaaS businesses
  version: 1.0.0
servers:
  - url: https://www.referly.so/api/v1
security:
  - bearerAuth: []
paths:
  /links:
    get:
      summary: Get all affiliate links or by ID/link/affiliate
      description: >-
        Returns a list of affiliate links based on the affiliate program,
        filtered by optional link ID, link string, affiliate ID, or affiliate
        email
      parameters:
        - name: id
          in: query
          description: The ID of the affiliate link to retrieve
          schema:
            type: string
            format: uuid
        - name: link
          in: query
          description: The link string of the affiliate link to retrieve
          schema:
            type: string
        - name: affiliateId
          in: query
          description: The affiliate ID to get links for
          schema:
            type: string
            format: uuid
        - name: affiliateEmail
          in: query
          description: The email of the affiliate to get links for
          schema:
            type: string
            format: email
      responses:
        '200':
          description: A list of affiliate links or a single affiliate link
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/AffiliateLink'
        '400':
          description: Unexpected error
          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
        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
        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: Total revenue generated by this link
        fullURLs:
          type: array
          description: Array of full URLs for this affiliate link
          items:
            type: object
            properties:
              baseUrl:
                type: string
                description: The base URL
              fullUrl:
                type: string
                description: The complete affiliate URL with parameters
    Error:
      type: object
      properties:
        error:
          type: integer
          description: Error code
        message:
          type: string
          description: Error message
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````