openapi: 3.0.3
info:
  title: Everflow Network API - Utilities
  description: Utility endpoints for encoding and decoding IDs.
  version: 1.0.0
servers:
  - url: https://api.eflow.team/v1
tags:
  - name: Encoding
paths:
  /networks/encode:
    post:
      summary: Encode IDs
      tags:
        - 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
                  enum:
                    - tracking_link_affiliate
                    - tracking_link_offer
                    - smart_link_affiliate
                    - smart_link_smart_link
                    - signup_affiliate_employee
                    - signup_advertiser_employee
                    - signup_affiliate_affiliate
                  description: >
                    The encoding context. Determines how the IDs are encoded
                    based on their intended use.
                ids:
                  type: array
                  items:
                    type: integer
                  description: The numeric IDs to encode.
      responses:
        "200":
          description: ""
          content:
            application/json:
              schema:
                type: object
                properties:
                  values:
                    type: array
                    items:
                      type: object
                      properties:
                        decoded:
                          type: integer
                          description: The original numeric ID.
                        encoded:
                          type: string
                          description: The encoded string representation.
      security:
        - API Key: []
  /networks/decode:
    post:
      summary: Decode IDs
      tags:
        - Encoding
      requestBody:
        required: true
        content:
          application/json:
            example:
              type: "tracking_link_offer"
              ids: ["2CTPL", "3QQG7", "55M6S"]
            schema:
              type: object
              required:
                - type
                - ids
              properties:
                type:
                  type: string
                  enum:
                    - tracking_link_affiliate
                    - tracking_link_offer
                    - smart_link_affiliate
                    - smart_link_smart_link
                    - signup_affiliate_employee
                    - signup_advertiser_employee
                    - signup_affiliate_affiliate
                  description: >
                    The encoding context. Must match the context used when the IDs
                    were originally encoded.
                ids:
                  type: array
                  items:
                    type: string
                  description: The encoded string values to decode.
      responses:
        "200":
          description: ""
          content:
            application/json:
              schema:
                type: object
                properties:
                  values:
                    type: array
                    items:
                      type: object
                      properties:
                        decoded:
                          type: integer
                          description: The original numeric ID. Returns 0 if the value could not be decoded.
                        encoded:
                          type: string
                          description: The encoded string that was submitted.
      security:
        - API Key: []
components:
  securitySchemes:
    API Key:
      description: The Everflow API key generated from the Control Center > Security.
      in: header
      name: X-Eflow-Api-Key
      type: apiKey
