openapi: 3.0.3
info:
  title: Everflow Affiliate API - Encoding
  description: >
    ID encoding and decoding endpoints for the Everflow Affiliate API. These
    endpoints allow affiliates to convert between numeric IDs and their encoded
    string representations used in tracking links and URLs.
  version: 1.0.0
servers:
  - description: Production Server
    url: https://api.eflow.team/v1
tags:
  - name: Affiliate Encoding
    description: Endpoints for encoding and decoding Everflow IDs.
paths:
  /affiliates/encode:
    post:
      summary: Encode IDs
      tags:
        - Affiliate Encoding
      requestBody:
        required: true
        content:
          application/json:
            example:
              type: "tracking_link_affiliate"
              ids:
                - 1
                - 2
                - 3
            schema:
              type: object
              required:
                - type
                - ids
              properties:
                type:
                  type: string
                  description: >
                    The encoding context type. Determines how the IDs are encoded.
                  enum:
                    - tracking_link_affiliate
                    - tracking_link_offer
                    - smart_link_affiliate
                    - smart_link_smart_link
                ids:
                  type: array
                  description: Array of numeric IDs to encode.
                  items:
                    type: integer
      responses:
        "200":
          description: ""
          content:
            application/json:
              example:
                values:
                  - decoded: 1
                    encoded: "28KL6"
                  - decoded: 2
                    encoded: "3J67C"
                  - decoded: 3
                    encoded: "4RQSJ"
              schema:
                type: object
                properties:
                  values:
                    type: array
                    description: Array of encoded values corresponding to the input IDs.
                    items:
                      type: object
                      properties:
                        decoded:
                          type: integer
                          description: The original numeric ID.
                        encoded:
                          type: string
                          description: The encoded string representation.
      security:
        - API Key: []

  /affiliates/decode:
    post:
      summary: Decode IDs
      tags:
        - Affiliate Encoding
      requestBody:
        required: true
        content:
          application/json:
            example:
              type: "tracking_link_affiliate"
              ids:
                - "28KL6"
                - "3J67C"
            schema:
              type: object
              required:
                - type
                - ids
              properties:
                type:
                  type: string
                  description: >
                    The encoding context type. Must match the type used during encoding.
                  enum:
                    - tracking_link_affiliate
                    - tracking_link_offer
                    - smart_link_affiliate
                    - smart_link_smart_link
                ids:
                  type: array
                  description: Array of encoded string values to decode.
                  items:
                    type: string
      responses:
        "200":
          description: ""
          content:
            application/json:
              example:
                values:
                  - decoded: 1
                    encoded: "28KL6"
                  - decoded: 2
                    encoded: "3J67C"
              schema:
                type: object
                properties:
                  values:
                    type: array
                    description: Array of decoded values corresponding to the input strings.
                    items:
                      type: object
                      properties:
                        decoded:
                          type: integer
                          description: The decoded numeric ID.
                        encoded:
                          type: string
                          description: The encoded string value.
      security:
        - API Key: []

components:
  securitySchemes:
    API Key:
      description: >
        The affiliate's API key generated from the Affiliate Portal.
        Uses the X-Eflow-Api-Key header.
      in: header
      name: X-Eflow-Api-Key
      type: apiKey
