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

# Create a conversion

> You are required to use either a referral code, customer_id, click id, coupon code, tracking id, or asset_id & source_id combination. If more than one of these is sent, the precedence will be as follows (highest to lowest): Customer id, Coupon, Referral Code, Click Id, Asset id + Source id, Tracking id



## OpenAPI

````yaml /api-reference/openapi.json post /conversions/
openapi: 3.0.3
info:
  title: Tapfiliate REST API
  version: '1.6'
  description: >-
    Reference for the Tapfiliate REST API. See the introduction for
    authentication, pagination and rate limits.
  x-generated-from: ApiBlueprint@e23e51f
servers:
  - url: https://api.tapfiliate.com/1.6
    description: Production
security:
  - ApiKey: []
tags:
  - name: Customers
    description: >-
      People who signed up or paid after being referred by an affiliate. With
      recurring or lifetime commissions, later conversions for the same customer
      go to the same affiliate.
  - name: Conversions
    description: >-
      Sales and other actions you pay commissions for. Each conversion has one
      or more commissions.
  - name: Commissions
    description: >-
      What an affiliate earns for a conversion. Approve or disapprove them
      before payout.
  - name: Affiliates
    description: >-
      The partners who promote your programs, with their meta data, notes,
      payout methods and balances.
  - name: Affiliate Groups
    description: Groups for organising your affiliates.
  - name: Affiliate Prospects
    description: >-
      People who signed up through a recruitment source but are not affiliates
      yet.
  - name: Programs
    description: >-
      Your affiliate programs, the affiliates in them and their commission
      settings.
  - name: Payments
    description: Settle affiliate balances and look up past payments.
  - name: Clicks
    description: Visits through affiliate links, the first step of attribution.
paths:
  /conversions/:
    post:
      tags:
        - Conversions
      summary: Create a conversion
      description: >-
        You are required to use either a referral code, customer_id, click id,
        coupon code, tracking id, or asset_id & source_id combination. If more
        than one of these is sent, the precedence will be as follows (highest to
        lowest): Customer id, Coupon, Referral Code, Click Id, Asset id + Source
        id, Tracking id
      operationId: createAConversion
      parameters:
        - name: override_max_cookie_time
          in: query
          description: ''
          schema:
            type: boolean
            default: 'false'
      requestBody:
        content:
          application/json:
            example:
              coupon: JANE10OFF
              external_id: ORD005
              amount: 100
              currency: EUR
              meta_data:
                foo: bar
              program_group: my-group
              user_agent: >-
                Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_1)
                AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100
                Safari/537.36
              ip: 111.11.11.111
            schema:
              type: object
              properties:
                referral_code:
                  type: string
                  example: janejameson
                  description: >-
                    An affiliate's referral code. This corresponds to the value
                    of `ref=` in their referral link.
                tracking_id:
                  type: string
                  example: XXXXX
                  description: >-
                    XXX-XXXX-XXXX-XXXXX (string) - The tracking id, to be
                    retrieved from our javascript library. Please refer to our
                    [REST API integration
                    guide](https://support.tapfiliate.com/en/articles/12682358-how-to-integrate-with-tapfiliate-via-the-rest-api)
                    for more info.
                click_id:
                  type: string
                  example: 1-abc
                  description: The click id. Used to add additional reporting information.
                coupon:
                  type: string
                  example: JANE10OFF
                  description: A coupon code to track the conversion by
                currency:
                  type: string
                  example: USD
                  description: >-
                    The three letter ISO currency code. Override the program's
                    default currency for this conversion by explicitely passing
                    a currency code.
                asset_id:
                  type: string
                  example: 1-aaaaaa
                  description: The asset id
                source_id:
                  type: string
                  example: 1-ssssss
                  description: The source id
                external_id:
                  type: string
                  example: foobar1
                  description: >-
                    A unique id for this conversion. It can be anything that is
                    meaningful to you, like an order number, user id, email
                    adres etc.. After a conversion has taken place, you can find
                    this id alongside the conversion on our platform. This makes
                    it very easy to cross-reference data on our platform with
                    your own administration. This id has to be unique for every
                    conversion.
                amount:
                  type: number
                  example: 30.55
                  description: The conversion amount
                customer_id:
                  type: string
                  example: USER123
                  description: >-
                    The id for the current customer in your system. Depending on
                    your program settings, this can be used for recurring /
                    lifetime commissions. You can read more [about this
                    here](https://support.tapfiliate.com/en/articles/12682358-how-to-integrate-with-tapfiliate-via-the-rest-api)
                commission_type:
                  type: string
                  example: mycommissiontype
                  description: >-
                    If no commission type is supplied, the programs default
                    commission type is used
                commissions:
                  type: array
                  items: {}
                  description: Will override "amount" and "commission_type" if set
                program_group:
                  type: string
                  example: myprogramgroup
                  description: The program group id
                user_agent:
                  type: string
                  example: ua string
                  description: >-
                    The client's user agent string. Used for statistics and
                    fraud detection.
                ip:
                  type: string
                  example: 111.11.11.111
                  description: The client's ip. Used for fraud detection.
      responses:
        '200':
          description: OK
          headers: {}
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: number
                  external_id:
                    type: string
                  amount:
                    type: number
                  click:
                    nullable: true
                  commissions:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: number
                        conversion_sub_amount:
                          type: number
                        amount:
                          type: number
                        commission_type:
                          type: string
                        approved:
                          nullable: true
                        affiliate:
                          type: object
                          properties:
                            id:
                              type: string
                            firstname:
                              type: string
                            lastname:
                              type: string
                        kind:
                          type: string
                        currency:
                          type: string
                        created_at:
                          type: string
                        payout:
                          nullable: true
                        comment:
                          nullable: true
                        final:
                          nullable: true
                        commission_name:
                          type: string
                      required:
                        - id
                        - conversion_sub_amount
                        - amount
                        - commission_type
                        - approved
                        - kind
                        - affiliate
                        - currency
                        - created_at
                        - payout
                        - comment
                        - final
                        - commission_name
                  program:
                    type: object
                    properties:
                      id:
                        type: string
                      title:
                        type: string
                      currency:
                        type: string
                  affiliate:
                    type: object
                    properties:
                      id:
                        type: string
                      firstname:
                        type: string
                      lastname:
                        type: string
                  customer:
                    nullable: true
                  meta_data:
                    type: object
                    properties:
                      foo:
                        type: string
                  created_at:
                    type: string
                  warnings:
                    nullable: true
                  affiliate_meta_data:
                    nullable: true
              example:
                id: 2
                external_id: ORD005
                amount: 100
                click: null
                commissions:
                  - id: 2
                    conversion_sub_amount: 100
                    amount: 10
                    commission_type: standard
                    approved: null
                    affiliate:
                      id: janejameson
                      firstname: Jane
                      lastname: Jameson
                    kind: regular
                    currency: EUR
                    created_at: 2021-03-03T12:39:19+0000
                    payout: null
                    comment: null
                    final: null
                    commission_name: standard
                  - id: 3
                    conversion_sub_amount: 100
                    amount: 5
                    commission_type: level-2
                    approved: null
                    kind: level
                    affiliate:
                      id: sandrasanderson
                      firstname: Sandra
                      lastname: Sanderson
                    currency: EUR
                    created_at: 2021-03-03T12:39:19+0000
                    payout: null
                    comment: null
                    final: null
                    commission_name: Level 2
                program:
                  id: johns-affiliate-program
                  title: John's affiliate program
                  currency: USD
                affiliate:
                  id: janejameson
                  firstname: Jane
                  lastname: Jameson
                customer: null
                meta_data:
                  foo: bar
                created_at: 2021-03-03T12:39:19+0000
                warnings: null
                affiliate_meta_data: null
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
components:
  responses:
    BadRequest:
      description: The request is invalid
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorList'
          example:
            errors:
              - message: Missing mandatory parameter(s)
    Unauthorized:
      description: The API key is missing or wrong
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/RequestError'
          example:
            message: Authentication Failed.
            code: 401
    Forbidden:
      description: No API access or no permission for this action
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/RequestError'
          example:
            message: Forbidden
            code: 403
            traceId: 04ed655728a22bc0d39f
  schemas:
    ErrorList:
      type: object
      description: Business and validation errors raised by an endpoint.
      properties:
        errors:
          type: array
          items:
            type: object
            properties:
              message:
                type: string
              code:
                type: string
                description: Machine-readable code, on 409 responses.
              property_path:
                type: string
                description: The invalid field, on validation errors.
            required:
              - message
      required:
        - errors
    RequestError:
      type: object
      description: >-
        Errors raised before the endpoint runs: authentication, access, unknown
        path, server error.
      properties:
        message:
          type: string
        code:
          type: integer
        traceId:
          type: string
          description: Send this to support to find the request.
      required:
        - message
        - code
  securitySchemes:
    ApiKey:
      type: apiKey
      in: header
      name: X-Api-Key
      description: Your API key, from your Tapfiliate account settings.

````

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