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

# Report a sale

> Attaches a sale to the subscriber, then to the last e-mail they actually opened or clicked inside the attribution window (14 days by default; a click beats an open). The same `reference` sent twice stays one sale (200 instead of 201).



## OpenAPI

````yaml /api-reference/openapi.json post /api/v1/conversions
openapi: 3.1.0
info:
  title: Lekalao API
  version: 1.0.0
  description: >-
    Everything the interface does, your application can do too. Every call
    carries an API token (Settings → API tokens).
servers:
  - url: https://{host}
    description: Your installation
    variables:
      host:
        default: lekalao.example.com
        description: The domain of your own Lekalao
security:
  - bearer: []
tags:
  - name: Lists
  - name: Subscribers
  - name: Tags
  - name: Segments
  - name: Imports
  - name: Templates
  - name: Campaigns
  - name: Automations
  - name: Transactional e-mails
  - name: Revenue
  - name: Platform
paths:
  /api/v1/conversions:
    post:
      tags:
        - Revenue
      summary: Report a sale
      description: >-
        Attaches a sale to the subscriber, then to the last e-mail they actually
        opened or clicked inside the attribution window (14 days by default; a
        click beats an open). The same `reference` sent twice stays one sale
        (200 instead of 201).
      operationId: api.conversions.store
      parameters:
        - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - email
                - amount
                - currency
              properties:
                email:
                  type: string
                  format: email
                list:
                  type:
                    - string
                    - 'null'
                  format: uuid
                  description: Limits the search for the subscriber to this list.
                amount:
                  type: integer
                  minimum: 0
                  description: 'In the smallest unit: 1250 is 12.50 €; 15000 is 15,000 FCFA.'
                currency:
                  type: string
                  minLength: 3
                  maxLength: 3
                reference:
                  type:
                    - string
                    - 'null'
                  description: Your own order number.
                occurred_at:
                  type:
                    - string
                    - 'null'
                  format: date-time
                meta:
                  type:
                    - object
                    - 'null'
                  additionalProperties: true
            example:
              email: ada@example.com
              amount: 15000
              currency: XAF
              reference: CMD-1024
      responses:
        '200':
          description: That reference was already recorded.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/Conversion'
        '201':
          description: Sale recorded.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/Conversion'
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          description: This address is on no list.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Message'
        '422':
          $ref: '#/components/responses/ValidationFailed'
        '429':
          $ref: '#/components/responses/TooManyRequests'
components:
  parameters:
    IdempotencyKey:
      name: Idempotency-Key
      in: header
      required: false
      schema:
        type: string
        maxLength: 255
      description: >-
        Replay a write safely: the same key gives back the first answer for 24
        hours (header Idempotent-Replay: true).
  schemas:
    Conversion:
      type: object
      properties:
        id:
          type: string
          format: uuid
        amount:
          type: integer
          description: In the smallest unit of the currency.
        currency:
          type: string
          example: XAF
        reference:
          type:
            - string
            - 'null'
        campaign:
          type:
            - string
            - 'null'
          format: uuid
          description: The campaign credited, when the sale is attributed to one.
        attributed:
          type: boolean
          description: >-
            True when an e-mail opened or clicked inside the attribution window
            was credited.
        occurred_at:
          type: string
          format: date-time
    Message:
      type: object
      properties:
        message:
          type: string
    ValidationError:
      type: object
      properties:
        message:
          type: string
          example: The email field must be a valid email address.
        errors:
          type: object
          additionalProperties:
            type: array
            items:
              type: string
  responses:
    Unauthenticated:
      description: No token, or an invalid or revoked one.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Message'
          example:
            message: Unauthenticated.
    Forbidden:
      description: The token lacks the ability needed, or the team is suspended.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Message'
    ValidationFailed:
      description: Invalid data.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ValidationError'
    TooManyRequests:
      description: >-
        The token's limit is reached. Wait the number of seconds Retry-After
        gives.
      headers:
        X-RateLimit-Limit:
          schema:
            type: integer
          description: Calls allowed per minute for this token.
        X-RateLimit-Remaining:
          schema:
            type: integer
        Retry-After:
          schema:
            type: integer
  securitySchemes:
    bearer:
      type: http
      scheme: bearer
      description: >-
        An API token. The "read" ability: GET routes only. "read + write": every
        route.

````