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

# Import existing affiliates

> For migrating affiliates from another platform. Creates up to 1,000 enabled affiliate accounts
and emails each one an invitation to sign in to your program.
            
`paid` is recorded as commission already paid out, and `balance` as the affiliate's opening
balance, so their history and what they're owed carry over. Affiliates whose `externalId`
already exists in your program are skipped.



## OpenAPI

````yaml https://platform.affelios.com/swagger/v1/swagger.json post /api/v1/affiliate/import
openapi: 3.0.4
info:
  title: Affelios Platform API
  description: >-
    Send customers and transactions to Affelios, and read your affiliate
    program's data. Authenticate every request with an API key in the X-Api-Key
    header. Create keys in the dashboard under Settings > API keys.
  version: v1
servers:
  - url: https://platform.affelios.com
security:
  - ApiKey: []
tags:
  - name: Affiliates
    description: >-
      Affiliate accounts in your program, their collaborators and their
      commission plan assignments.
  - name: Customers
    description: >-
      Customers referred by affiliates. Create a customer with the click key
      from the landing page to credit the affiliate who referred them.
  - name: Mcp Connection
  - name: Testimonials
    description: Affiliate testimonials and the published list shown on public pages.
  - name: Transactions
    description: >-
      Customer activity such as deposits, revenue and wagering. Commission is
      calculated from transactions.
paths:
  /api/v1/affiliate/import:
    post:
      tags:
        - Affiliates
      summary: Import existing affiliates
      description: >-
        For migrating affiliates from another platform. Creates up to 1,000
        enabled affiliate accounts

        and emails each one an invitation to sign in to your program.
                    
        `paid` is recorded as commission already paid out, and `balance` as the
        affiliate's opening

        balance, so their history and what they're owed carry over. Affiliates
        whose `externalId`

        already exists in your program are skipped.
      operationId: AffiliateImportPost
      requestBody:
        description: The affiliates to import, at most 1,000.
        content:
          application/json:
            schema:
              allOf:
                - $ref: '#/components/schemas/AffiliateImportBody'
              description: Affiliates to import.
      responses:
        '200':
          description: How many affiliates were imported, skipped as duplicates, or failed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AffiliateImportResponse'
        '400':
          description: >-
            The list is empty or has more than 1,000 affiliates, or a required
            field is missing.
        '401':
          description: The X-Api-Key header is missing or the key is not valid.
        '403':
          description: The API key is valid but does not have permission for this endpoint.
components:
  schemas:
    AffiliateImportBody:
      required:
        - items
      type: object
      properties:
        items:
          type: array
          items:
            $ref: '#/components/schemas/AffiliateImportLineItem'
          description: The affiliates, at most 1,000 per request.
      additionalProperties: false
      description: Affiliates to import.
    AffiliateImportResponse:
      type: object
      properties:
        numImported:
          type: integer
          description: Affiliates created.
          format: int32
        numDuplicates:
          type: integer
          description: >-
            Affiliates skipped because one with the same external ID already
            exists.
          format: int32
        numFailed:
          type: integer
          description: Affiliates that could not be created.
          format: int32
        firstFailureId:
          type: string
          description: >-
            The external ID of the last affiliate that failed. When several
            fail, this may not be the affiliate `firstFailureMessage` describes.
          nullable: true
        firstFailureMessage:
          type: string
          description: Why the first failed affiliate was rejected.
          nullable: true
      additionalProperties: false
      description: The result of importing affiliates.
    AffiliateImportLineItem:
      required:
        - balance
        - email
        - externalId
        - name
        - paid
        - username
      type: object
      properties:
        externalId:
          minLength: 1
          type: string
          description: >-
            The affiliate's ID on your previous platform. Affiliates with an ID
            that already exists are skipped.
        email:
          minLength: 1
          type: string
          description: >-
            The affiliate's email address. The invitation to sign in is sent
            here.
        username:
          minLength: 1
          type: string
          description: The affiliate account name shown in your program.
        name:
          minLength: 1
          type: string
          description: The affiliate's full name.
        website:
          type: string
          description: The affiliate's website.
          nullable: true
        companyName:
          type: string
          description: The affiliate's company name.
          nullable: true
        companyNumber:
          type: string
          description: The affiliate's company registration number.
          nullable: true
        addressLine1:
          type: string
          description: First line of the affiliate's address.
          nullable: true
        addressLine2:
          type: string
          description: Second line of the affiliate's address.
          nullable: true
        city:
          type: string
          description: Town or city.
          nullable: true
        region:
          type: string
          description: Region, county or state.
          nullable: true
        country:
          type: string
          description: Country.
          nullable: true
        postcode:
          type: string
          description: Postcode or ZIP code.
          nullable: true
        balance:
          type: number
          description: >-
            The balance the affiliate is owed, which becomes their opening
            balance. Use `0` if none.
          format: double
        paid:
          type: number
          description: The total commission already paid to the affiliate. Use `0` if none.
          format: double
      additionalProperties: false
      description: An affiliate to import from another platform.
  securitySchemes:
    ApiKey:
      type: apiKey
      description: >-
        Your Affelios API key. Create one in the dashboard under Settings > API
        keys.
      name: X-Api-Key
      in: header

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.