> ## 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.

# Create a customer

> Call this when a visitor registers on your site. Send the click key your site stored when
they arrived from an affiliate link, and Affelios credits the customer to that affiliate.
A Google click ID (gclid) is also accepted in `clickKey`.
            
If the click key is missing or not recognised, the customer is credited to your default
tracker when Organic Tracking is on in your settings. When it's off, the request fails.
            
Send transactions for the customer afterwards, using the same `externalId`.



## OpenAPI

````yaml https://platform.affelios.com/swagger/v1/swagger.json post /api/v1/customer
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/customer:
    post:
      tags:
        - Customers
      summary: Create a customer
      description: >-
        Call this when a visitor registers on your site. Send the click key your
        site stored when

        they arrived from an affiliate link, and Affelios credits the customer
        to that affiliate.

        A Google click ID (gclid) is also accepted in `clickKey`.
                    
        If the click key is missing or not recognised, the customer is credited
        to your default

        tracker when Organic Tracking is on in your settings. When it's off, the
        request fails.
                    
        Send transactions for the customer afterwards, using the same
        `externalId`.
      operationId: CustomerPost
      requestBody:
        description: The customer to create.
        content:
          application/json:
            schema:
              allOf:
                - $ref: '#/components/schemas/AffiliateCustomerBody'
              description: A customer who registered on your site.
      responses:
        '200':
          description: The customer was created and attributed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AffiliateCustomer'
        '400':
          description: >-
            The brand ID is not valid, a customer with this external ID already
            exists for the brand,
                         or the click key is not valid and Organic Tracking is off. The response body explains which.
        '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:
    AffiliateCustomerBody:
      required:
        - brandId
        - externalId
      type: object
      properties:
        externalId:
          minLength: 1
          type: string
          description: >-
            Your unique ID for the customer. Transactions are matched to the
            customer by this ID.
        brandId:
          minLength: 1
          type: string
          description: The Affelios ID of the brand the customer registered with.
        clickKey:
          type: string
          description: >-
            The click key your site stored when the customer arrived from an
            affiliate link. A Google click ID (gclid) is also accepted.
          nullable: true
        username:
          type: string
          description: A display name for the customer, shown in reports.
          nullable: true
        registrationDate:
          type: string
          description: When the customer registered, in UTC.
          format: date-time
        country_code:
          type: string
          description: The customer's country as an ISO country code, for example `GB`.
          nullable: true
        operatorId:
          type: string
          description: >-
            Not needed when you authenticate with an API key: your program is
            taken from the key.
          nullable: true
      additionalProperties: false
      description: A customer who registered on your site.
    AffiliateCustomer:
      type: object
      properties:
        id:
          type: string
          nullable: true
        operatorId:
          type: string
          nullable: true
        updatedTs:
          type: string
          format: date-time
        createdTs:
          type: string
          format: date-time
          nullable: true
        isIdEmpty:
          type: boolean
          readOnly: true
        createdBy:
          type: string
          nullable: true
        hidden:
          type: boolean
        deleted:
          type: boolean
        importId:
          type: string
          nullable: true
        externalId:
          type: string
          nullable: true
        externalBrandId:
          type: string
          nullable: true
        username:
          type: string
          nullable: true
        country:
          type: string
          nullable: true
        country_code:
          type: string
          nullable: true
        registerIp:
          type: string
          nullable: true
        registrationDate:
          type: string
          format: date-time
        hasDeposited:
          type: boolean
        ftdDate:
          type: string
          format: date-time
        cpaQualified:
          type: boolean
        cpaQualificationDate:
          type: string
          format: date-time
        lifetimeRevenue:
          type: number
          format: double
        firstDepositAmount:
          type: number
          format: double
          nullable: true
        firstRevenueAmount:
          type: number
          format: double
          nullable: true
        lifetimeDeposits:
          type: number
          format: double
          nullable: true
        lifetimeRevShareCommission:
          type: number
          format: double
        lifetimeCpaCommission:
          type: number
          format: double
        lifetimeFixedCommission:
          type: number
          format: double
        lifetimeCommission:
          type: number
          format: double
        tracking:
          allOf:
            - $ref: '#/components/schemas/TrackingDimensions'
          nullable: true
        category:
          type: string
          nullable: true
        label:
          type: string
          nullable: true
        revShareExcluded:
          type: boolean
        cpaExcluded:
          type: boolean
        transactions:
          type: array
          items:
            $ref: '#/components/schemas/Transaction'
          nullable: true
      additionalProperties: false
    TrackingDimensions:
      type: object
      properties:
        clickId:
          type: string
          nullable: true
        affiliateId:
          type: string
          nullable: true
        affiliateName:
          type: string
          nullable: true
        affiliateTrackerId:
          type: string
          nullable: true
        affiliateTrackerName:
          type: string
          nullable: true
        brandId:
          type: string
          nullable: true
        brandName:
          type: string
          nullable: true
        productId:
          type: string
          nullable: true
        productName:
          type: string
          nullable: true
        mediaId:
          type: string
          nullable: true
        media:
          allOf:
            - $ref: '#/components/schemas/StatMedia'
          nullable: true
        customParameter:
          type: string
          nullable: true
        date:
          type: string
          format: date-time
        referringUrl:
          type: string
          nullable: true
      additionalProperties: false
    Transaction:
      type: object
      properties:
        id:
          type: string
          nullable: true
        operatorId:
          type: string
          nullable: true
        updatedTs:
          type: string
          format: date-time
        createdTs:
          type: string
          format: date-time
          nullable: true
        isIdEmpty:
          type: boolean
          readOnly: true
        createdBy:
          type: string
          nullable: true
        hidden:
          type: boolean
        deleted:
          type: boolean
        importId:
          type: string
          nullable: true
        integrationType:
          type: string
          nullable: true
        customerId:
          type: string
          nullable: true
        type:
          type: string
          nullable: true
        externalId:
          type: string
          nullable: true
        externalCustomerId:
          type: string
          nullable: true
        externalBrandId:
          type: string
          nullable: true
        externalProductId:
          type: string
          nullable: true
        country:
          type: string
          nullable: true
        country_code:
          type: string
          nullable: true
        depositAmount:
          type: number
          format: double
        firstTransaction:
          type: boolean
        grossRevenue:
          type: number
          format: double
        revenueAmount:
          type: number
          format: double
        wageredAmount:
          type: number
          format: double
        taxes:
          type: number
          format: double
        costOfGoodsSold:
          type: number
          format: double
        paymentFees:
          type: number
          format: double
        cpaQualified:
          type: boolean
        revShareCommission:
          type: number
          format: double
        cpaCommission:
          type: number
          format: double
        fixedCommission:
          type: number
          format: double
        transactionDate:
          type: string
          format: date-time
        periodId:
          type: integer
          format: int32
        tracking:
          allOf:
            - $ref: '#/components/schemas/TrackingDimensions'
          nullable: true
        category:
          type: string
          nullable: true
        label:
          type: string
          nullable: true
        note:
          type: string
          nullable: true
        childAffiliateIds:
          type: array
          items:
            type: string
          nullable: true
        payoutInfo:
          allOf:
            - $ref: '#/components/schemas/TransactionPayoutInfo'
          nullable: true
        planId:
          type: string
          nullable: true
        planName:
          type: string
          nullable: true
      additionalProperties: false
    StatMedia:
      type: object
      properties:
        type:
          type: string
          nullable: true
        text:
          type: string
          nullable: true
        imageUrl:
          type: string
          nullable: true
      additionalProperties: false
    TransactionPayoutInfo:
      type: object
      properties:
        affiliateId:
          type: string
          nullable: true
        affiliateName:
          type: string
          nullable: true
        invoicePeriod:
          type: string
          nullable: true
        invoiceDate:
          type: string
          format: date-time
        dueDate:
          type: string
          format: date-time
          nullable: true
        payoutMethod:
          allOf:
            - $ref: '#/components/schemas/PayoutMethod'
          nullable: true
        paymentDate:
          type: string
          format: date-time
          nullable: true
        amount:
          type: number
          format: double
        tax:
          type: number
          format: double
        total:
          type: number
          format: double
        notes:
          type: string
          nullable: true
        email:
          type: string
          nullable: true
        website:
          type: string
          nullable: true
        affiliateContact:
          type: string
          nullable: true
        affiliateCompany:
          type: string
          nullable: true
        affiliateCompanyNo:
          type: string
          nullable: true
        affiliateAddress:
          allOf:
            - $ref: '#/components/schemas/ContactAddress'
          nullable: true
        affiliateTaxIds:
          type: array
          items:
            $ref: '#/components/schemas/PaymentTaxId'
          nullable: true
        affiliateVatRegistered:
          type: boolean
          nullable: true
        affiliateTaxRate:
          type: number
          format: double
        companyName:
          type: string
          nullable: true
        companyInvoiceAddress:
          allOf:
            - $ref: '#/components/schemas/ContactAddress'
          nullable: true
        companyTaxIds:
          type: array
          items:
            $ref: '#/components/schemas/PaymentTaxId'
          nullable: true
        companyNumber:
          type: string
          nullable: true
        accountsEmail:
          type: string
          nullable: true
        currencyCode:
          type: string
          nullable: true
      additionalProperties: false
    PayoutMethod:
      type: object
      properties:
        id:
          type: string
          nullable: true
        operatorId:
          type: string
          nullable: true
        updatedTs:
          type: string
          format: date-time
        createdTs:
          type: string
          format: date-time
          nullable: true
        isIdEmpty:
          type: boolean
          readOnly: true
        createdBy:
          type: string
          nullable: true
        hidden:
          type: boolean
        deleted:
          type: boolean
        companyId:
          type: string
          nullable: true
        companyName:
          type: string
          nullable: true
        type:
          type: string
          nullable: true
        payee:
          type: string
          nullable: true
        walletAddress:
          type: string
          nullable: true
        email:
          type: string
          nullable: true
        iban:
          type: string
          nullable: true
        swift:
          type: string
          nullable: true
        accountNumber:
          type: string
          nullable: true
        sortcode:
          type: string
          nullable: true
        bankName:
          type: string
          nullable: true
        bankAddress:
          allOf:
            - $ref: '#/components/schemas/ContactAddress'
          nullable: true
      additionalProperties: false
    ContactAddress:
      type: object
      properties:
        addressLine:
          type: string
          nullable: true
        addressLine2:
          type: string
          nullable: true
        city:
          type: string
          nullable: true
        region:
          type: string
          nullable: true
        country:
          type: string
          nullable: true
        postcode:
          type: string
          nullable: true
      additionalProperties: false
    PaymentTaxId:
      type: object
      properties:
        id:
          type: string
          nullable: true
        value:
          type: string
          nullable: true
        type:
          type: string
          nullable: true
        country:
          type: string
          nullable: true
        stripeId:
          type: string
          nullable: true
        stripeStatus:
          type: string
          nullable: true
      additionalProperties: false
  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.