openapi: 3.0.1
info:
  title: Dashboard API
  description: The definition of the CDP Dashboard APP APIs.
  contact:
    email: info@audiencerate.it
  license:
    name: Apache 2.0
    url: http://www.apache.org/licenses/LICENSE-2.0.html
  version: "1.0"
servers:
- url: https://api.audiencerate.dev
  description: Develop server (use test data)
paths:
  /:
    get:
      operationId: redirect
      responses:
        default:
          description: default response
          content:
            '*/*': {}
  /v1/workspaces/{workspaceId}/audiences/count:
    get:
      tags:
      - audiences
      summary: "counts the audiences for a workspace, optionally filtered by query"
      operationId: countAudiences
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      - name: q
        in: query
        schema:
          type: string
      responses:
        "200":
          description: number of audiences
          content:
            application/json:
              schema:
                type: integer
                format: int64
      security:
      - oauth2:
        - read:audience
  /v1/workspaces/{workspaceId}/audiences:
    get:
      tags:
      - audiences
      summary: retrieves a list of audiences
      operationId: getAudiences_1
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      - name: realtimeOnly
        in: query
        schema:
          type: boolean
          default: false
      - name: limit
        in: query
        schema:
          type: integer
          format: int32
          default: 50
      - name: offset
        in: query
        schema:
          type: integer
          format: int32
          default: 0
      - name: q
        in: query
        schema:
          type: string
      responses:
        "200":
          description: the list of audiences
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/PaginatedAudience"
      security:
      - oauth2:
        - read:audience
    post:
      tags:
      - audiences
      summary: creates an audience
      operationId: createAudience
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      requestBody:
        description: the audience payload required for the creation
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateAudienceBody"
        required: true
      responses:
        "200":
          description: the created audience
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AudienceDTO"
        "500":
          description: Internal server error
      security:
      - oauth2:
        - write:audience
  /v1/workspaces/{workspaceId}/audiences/{audienceId}:
    get:
      tags:
      - audiences
      summary: retrieves a single audience
      operationId: getAudience
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      - name: audienceId
        in: path
        required: true
        schema:
          type: string
      - name: includeDeleted
        in: query
        schema:
          type: boolean
          default: false
      responses:
        "200":
          description: the audience
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AudienceDTO"
      security:
      - oauth2:
        - read:audience
    delete:
      tags:
      - audiences
      summary: deletes a single audience
      operationId: delete
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      - name: audienceId
        in: path
        required: true
        schema:
          type: string
      responses:
        "200":
          description: the confirmation of the deletion
          content:
            application/json: {}
      security:
      - oauth2:
        - write:audience
    patch:
      tags:
      - audiences
      summary: updates a single audience
      operationId: update
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      - name: audienceId
        in: path
        required: true
        schema:
          type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UpdateAudienceBody"
      responses:
        "200":
          description: the updated audience
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AudienceDTO"
      security:
      - oauth2:
        - write:audience
  /v1/workspaces/{workspaceId}/audiences/{audienceId}/evaluate:
    post:
      tags:
      - audiences
      summary: evaluate now an audience
      operationId: evaluateAudience
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      - name: audienceId
        in: path
        required: true
        schema:
          type: string
      responses:
        default:
          description: default response
          content:
            application/json: {}
      security:
      - oauth2:
        - write:audience
  /v1/workspaces/{workspaceId}/audiences/{audienceId}/evaluate/{evalType}:
    post:
      tags:
      - audiences
      summary: evaluate now an audience
      operationId: evaluateAudienceWithEvalType
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      - name: audienceId
        in: path
        required: true
        schema:
          type: string
      - name: evalType
        in: path
        required: true
        schema:
          type: string
          enum:
          - syncAudience
          - purgeEvalAudience
          - evalAudience
          - purgeEvalAudienceNotSync
          default: purgeEvalAudienceNotSync
      responses:
        default:
          description: default response
          content:
            application/json: {}
      security:
      - oauth2:
        - admin:write:audiences
  /v1/workspaces/{workspaceId}/audiences/all:
    get:
      tags:
      - audiences
      summary: retrieves a list of audiences
      operationId: getAllAudiences
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      - name: limit
        in: query
        schema:
          type: integer
          format: int32
          default: 50
      - name: offset
        in: query
        schema:
          type: integer
          format: int32
          default: 0
      - name: q
        in: query
        schema:
          type: string
      responses:
        "200":
          description: the list of audiences
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/PaginatedAllAudience"
      security:
      - oauth2:
        - read:audience
  /v1/workspaces/{workspaceId}/audiences/{audienceId}/dependencies:
    get:
      tags:
      - audiences
      summary: get the dependencies of an audience
      operationId: getAudienceDependencies
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      - name: audienceId
        in: path
        required: true
        schema:
          type: string
      responses:
        "200":
          description: the dependencies
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AudienceDependencies"
      security:
      - oauth2:
        - read:audience
  /v1/workspaces/{workspaceId}/audiences/{audienceId}/estimate:
    get:
      tags:
      - audiences
      summary: get an estimate of an audience
      operationId: getAudienceEstimate
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      - name: audienceId
        in: path
        required: true
        schema:
          type: string
      responses:
        "200":
          description: the audience estimate
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AudienceEstimate"
      security:
      - oauth2:
        - read:audience
    post:
      tags:
      - audiences
      summary: get an estimate of an audience
      operationId: getAudienceEstimateWithExpression
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      - name: audienceId
        in: path
        required: true
        schema:
          type: string
      requestBody:
        description: the audience expression
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/AudienceEstimateBody"
        required: true
      responses:
        "200":
          description: the audience estimate
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AudienceEstimate"
      security:
      - oauth2:
        - write:audience
  /v1/workspaces/{workspaceId}/audiences/multi:
    get:
      tags:
      - audiences
      summary: retrieves multiple audiences
      operationId: getAudiences
      parameters:
      - name: audienceId
        in: query
        schema:
          type: array
          items:
            type: string
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      responses:
        "200":
          description: the list of audiences
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/AudienceDTO"
      security:
      - oauth2:
        - read:audience
  /v1/workspaces/{workspaceId}/audiences/estimate:
    get:
      tags:
      - audiences
      summary: get estimates of multiple audience
      operationId: getAudiencesEstimate
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      - name: audienceIds
        in: query
        schema:
          type: array
          items:
            type: string
      responses:
        "200":
          description: the list of audience estimates
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/AudienceEstimate"
      security:
      - oauth2:
        - read:audience
  /v1/workspaces/{workspaceId}/audiences/{audienceId}/next-schedule:
    get:
      tags:
      - audiences
      summary: get the next evaluation time for and audience
      operationId: getNextEvaluation
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      - name: audienceId
        in: path
        required: true
        schema:
          type: string
      responses:
        "200":
          description: the next evaluation time if applicable
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AudienceNextSchedule"
      security:
      - oauth2:
        - read:audience
  /v1/workspaces/{workspaceId}/audiences/next-schedules:
    post:
      tags:
      - audiences
      summary: get the next evaluations time for an audience configuration
      operationId: getNextEvaluations
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/AudienceScheduleEvaluationBody"
      responses:
        "200":
          description: the next evaluations time if applicable
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AudienceNextSchedules"
      security:
      - oauth2:
        - read:audience
  /v1/workspaces/{workspaceId}/audiences/{audienceId}/property-operations:
    get:
      tags:
      - audiences
      summary: Return the available comparison-operations for every property type
      operationId: getPropertyOperations
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      - name: audienceId
        in: path
        required: true
        schema:
          type: string
      responses:
        "200":
          description: Mapping between property type and available comparison-operations
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/PropertyOperationsDTO"
        "404":
          description: Workspace or audience not found
        "500":
          description: Internal server error
      security:
      - oauth2:
        - read:audience
  /v1/workspaces/{workspaceId}/audiences/{audienceId}/trait-distributions:
    get:
      tags:
      - audiences
      summary: get the trait distributions for an audience
      operationId: getTraitDistributions
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      - name: audienceId
        in: path
        required: true
        schema:
          type: string
      responses:
        "200":
          description: the list of traits with their distribution count and totals
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/AudienceTraitDistributions"
      security:
      - oauth2:
        - read:audience
  /v1/workspaces/{workspaceId}/audiences/{audienceId}/extraction/download:
    get:
      tags:
      - audiences
      summary: Download the audience extraction file
      description: Downloads the generated CSV file once it’s ready.
      operationId: downloadCsv
      parameters:
      - name: audienceId
        in: path
        description: Unique identifier for the audience
        required: true
        schema:
          type: string
      - name: workspaceId
        in: path
        description: Unique identifier for the workspace
        required: true
        schema:
          type: string
      responses:
        "200":
          description: CSV file download successful
          content:
            text/csv:
              schema:
                type: string
                format: binary
        "404":
          description: CSV file not found or not ready
        "500":
          description: Server error during file download
  /v1/workspaces/{workspaceId}/audiences/{audienceId}/extraction/status:
    get:
      tags:
      - audiences
      summary: Get audience extraction Status
      description: Retrieves the current status of the audience extraction job.
      operationId: getAudienceExtractionStatus
      parameters:
      - name: audienceId
        in: path
        description: Unique identifier for the audience
        required: true
        schema:
          type: string
      - name: workspaceId
        in: path
        description: Unique identifier for the workspace
        required: true
        schema:
          type: string
      responses:
        "200":
          description: Job status successfully retrieved or a placeholder status NOT_FOUND
            when no extraction is found
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ExtractionStatusDTO"
        "400":
          description: Missing or invalid parameters
        "500":
          description: Server error while fetching job status
  /v1/workspaces/{workspaceId}/audiences/{audienceId}/extraction:
    post:
      tags:
      - audiences
      summary: Start audience extraction
      description: "Initiates the extraction process for a specified audience. In\
        \ case there is already an extraction with ERROR status, it will be reset\
        \ to PENDING."
      operationId: startAudienceExtraction
      parameters:
      - name: audienceId
        in: path
        description: Unique identifier for the audience
        required: true
        schema:
          type: string
      - name: workspaceId
        in: path
        description: Unique identifier for the workspace
        required: true
        schema:
          type: string
      responses:
        "202":
          description: "Audience extraction job started, or reset"
        "400":
          description: Invalid request parameters
        "500":
          description: Server error while initiating audience extraction
  /v1/audiences/{audienceId}/configuration:
    get:
      tags:
      - audiences
      operationId: getAudienceConfiguration
      parameters:
      - name: audienceId
        in: path
        required: true
        schema:
          type: string
      responses:
        default:
          description: default response
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AudienceConfigurationDTO"
      security:
      - oauth2:
        - admin:read:audiences
  /v1/workspaces/{workspaceId}/audiences/{audienceId}/evaluations/history:
    get:
      tags:
      - audiences
      operationId: getAudienceConfiguration_1
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      - name: audienceId
        in: path
        required: true
        schema:
          type: string
      - name: limit
        in: query
        schema:
          type: integer
          format: int32
          default: 100
      - name: offset
        in: query
        schema:
          type: integer
          format: int32
          default: 0
      responses:
        default:
          description: default response
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/PagingObjectAudienceEvaluationHistoryDTO"
      security:
      - oauth2:
        - read:audience
    post:
      tags:
      - audiences
      operationId: addRefreshHistory
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      - name: audienceId
        in: path
        required: true
        schema:
          type: string
      responses:
        default:
          description: default response
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AudienceEvaluationHistoryDTO"
      security:
      - oauth2:
        - admin:write:audiences
  /v1/workspaces/{workspaceId}/campaigns/count:
    get:
      tags:
      - campaigns
      summary: "counts campaigns in a workspace, optionally filtered by name and status"
      operationId: countCampaigns
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      - name: search
        in: query
        schema:
          type: string
      - name: status
        in: query
        description: "Campaign status to filter by. Available values: ACTIVE, DRAFT"
        schema:
          type: string
          example: ACTIVE
          enum:
          - ACTIVE
          - DRAFT
      responses:
        "200":
          description: number of campaigns
          content:
            application/json:
              schema:
                type: integer
                format: int64
      security:
      - oauth2:
        - read:campaign
  /v1/workspaces/{workspaceId}/campaigns:
    get:
      tags:
      - campaigns
      summary: lists campaigns
      operationId: listCampaigns
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      - name: limit
        in: query
        schema:
          type: integer
          format: int32
          default: 10
      - name: offset
        in: query
        schema:
          type: integer
          format: int32
          default: 0
      - name: search
        in: query
        schema:
          type: string
          default: ""
      responses:
        "200":
          description: list of campaigns
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/CampaignDTO"
      security:
      - oauth2:
        - read:campaign
    post:
      tags:
      - campaigns
      summary: creates a campaign
      operationId: createCampaign
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      requestBody:
        description: the payload required for the campaign creation
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateCampaignBody"
        required: true
      responses:
        "200":
          description: the created campaign
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CampaignDTO"
      security:
      - oauth2:
        - write:campaign
  /v1/workspaces/{workspaceId}/campaigns/{campaignId}:
    get:
      tags:
      - campaigns
      summary: retrieves a specific campaign
      operationId: getCampaign
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      - name: campaignId
        in: path
        required: true
        schema:
          type: string
      responses:
        "200":
          description: the campaign details
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CampaignDTO"
        "404":
          description: campaign or workspace not found
      security:
      - oauth2:
        - read:campaign
    delete:
      tags:
      - campaigns
      summary: deletes a campaign
      operationId: deleteCampaign
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      - name: campaignId
        in: path
        required: true
        schema:
          type: string
      responses:
        "204":
          description: campaign deleted
        "404":
          description: campaign or workspace not found
      security:
      - oauth2:
        - write:campaign
    patch:
      tags:
      - campaigns
      summary: update a campaign
      operationId: updateCampaign
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      - name: campaignId
        in: path
        required: true
        schema:
          type: string
      requestBody:
        description: the payload required for the campaign update
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UpdateCampaignBody"
        required: true
      responses:
        "200":
          description: the updated campaign
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CampaignDTO"
        "404":
          description: campaign or workspace not found
        "400":
          description: Invalid request body
      security:
      - oauth2:
        - write:campaign
  /v1/workspaces/{workspaceId}/campaigns-v2/count:
    get:
      tags:
      - campaigns-v2
      summary: counts campaigns v2
      operationId: countCampaigns_1
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      - name: search
        in: query
        schema:
          type: string
      - name: status
        in: query
        schema:
          type: string
          enum:
          - ACTIVE
          - DRAFT
          - SCHEDULED
          - PAUSED
          - COMPLETED
      responses:
        "200":
          content:
            application/json:
              schema:
                type: integer
                format: int64
      security:
      - oauth2:
        - read:campaign
  /v1/workspaces/{workspaceId}/campaigns-v2:
    get:
      tags:
      - campaigns-v2
      summary: lists campaigns v2
      operationId: listCampaigns_1
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      - name: limit
        in: query
        schema:
          type: integer
          format: int32
          default: 10
      - name: offset
        in: query
        schema:
          type: integer
          format: int32
          default: 0
      - name: search
        in: query
        schema:
          type: string
          default: ""
      responses:
        "200":
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/CampaignV2DTO"
      security:
      - oauth2:
        - read:campaign
    post:
      tags:
      - campaigns-v2
      summary: creates a campaign v2
      operationId: createCampaign_1
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateCampaignV2Body"
        required: true
      responses:
        "200":
          description: the created campaign
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CampaignV2DTO"
      security:
      - oauth2:
        - write:campaign
  /v1/workspaces/{workspaceId}/campaigns-v2/{campaignId}:
    get:
      tags:
      - campaigns-v2
      summary: retrieves a specific campaign v2
      operationId: getCampaign_1
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      - name: campaignId
        in: path
        required: true
        schema:
          type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CampaignV2DTO"
        "404":
          description: campaign not found
      security:
      - oauth2:
        - read:campaign
    delete:
      tags:
      - campaigns-v2
      summary: deletes a campaign v2
      operationId: deleteCampaign_1
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      - name: campaignId
        in: path
        required: true
        schema:
          type: string
      responses:
        "204":
          description: campaign deleted
        "404":
          description: campaign not found
      security:
      - oauth2:
        - write:campaign
    patch:
      tags:
      - campaigns-v2
      summary: updates a campaign v2
      operationId: updateCampaign_1
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      - name: campaignId
        in: path
        required: true
        schema:
          type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UpdateCampaignV2Body"
        required: true
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CampaignV2DTO"
        "404":
          description: campaign not found
      security:
      - oauth2:
        - write:campaign
  /v1/workspaces/{workspaceId}/campaigns-v2/{campaignId}/stats:
    get:
      tags:
      - campaigns-v2
      summary: retrieves stats for a campaign
      operationId: getCampaignStats
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      - name: campaignId
        in: path
        required: true
        schema:
          type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CampaignStatsDTO"
      security:
      - oauth2:
        - read:campaign
  /v1/workspaces/{workspaceId}/campaigns-v2/stats/by-provider:
    get:
      tags:
      - campaigns-v2
      summary: retrieves aggregated stats grouped by provider type
      operationId: getStatsByProvider
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/ProviderAggregatedStatsDTO"
      security:
      - oauth2:
        - read:campaign
  /v1/workspaces/{workspaceId}/card-containers:
    get:
      tags:
      - cards
      summary: list card-containers belonging to a workspace
      operationId: readCardContainers
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      - name: resourceId
        in: query
        schema:
          type: string
      responses:
        "200":
          description: the card-containers list
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/PaginatedCardContainer"
      security:
      - oauth2:
        - read:workspaces
    post:
      tags:
      - cards
      summary: create a card-container
      operationId: createCardContainer
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      requestBody:
        description: the card-container info
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateCardContainerRequest"
        required: true
      responses:
        "200":
          description: the newly created card-container
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CardContainerDTO"
      security:
      - oauth2:
        - write:workspaces
  /v1/workspaces/{workspaceId}/card-containers/{cardContainerId}:
    delete:
      tags:
      - cards
      summary: delete a card-container
      operationId: deleteCardContainer
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      - name: cardContainerId
        in: path
        required: true
        schema:
          type: string
      responses:
        "200":
          description: the card-container removal confirmation
      security:
      - oauth2:
        - write:workspaces
    patch:
      tags:
      - cards
      summary: update a card-container
      operationId: updateCard
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      - name: cardContainerId
        in: path
        required: true
        schema:
          type: string
      requestBody:
        description: the card-container info
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateCardContainerRequest"
        required: true
      responses:
        "200":
          description: the updated card-container
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CardContainerDTO"
      security:
      - oauth2:
        - write:workspaces
  /v1/workspaces/{workspaceId}/cards:
    get:
      tags:
      - cards
      summary: list cards belonging to a workspace
      operationId: readCards
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      - name: resourceId
        in: query
        schema:
          type: string
      - name: cardIds
        in: query
        schema:
          type: string
          example: "ca-001,ca-002,ca-003"
      responses:
        "200":
          description: the cards list
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/PaginatedCard"
      security:
      - oauth2:
        - read:workspaces
    post:
      tags:
      - cards
      summary: create a card
      operationId: createCard
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      requestBody:
        description: the card info
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateCardRequest"
        required: true
      responses:
        "200":
          description: the newly created card
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CardDTO"
      security:
      - oauth2:
        - write:workspaces
  /v1/workspaces/{workspaceId}/cards/{cardId}:
    delete:
      tags:
      - cards
      summary: delete a card
      operationId: deleteCard
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      - name: cardId
        in: path
        required: true
        schema:
          type: string
      responses:
        "200":
          description: the card removal confirmation
      security:
      - oauth2:
        - write:workspaces
    patch:
      tags:
      - cards
      summary: update a card
      operationId: updateCard_1
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      - name: cardId
        in: path
        required: true
        schema:
          type: string
      requestBody:
        description: the card info
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateCardRequest"
        required: true
      responses:
        "200":
          description: the updated card
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CardDTO"
      security:
      - oauth2:
        - write:workspaces
  /v1/card-operations:
    get:
      tags:
      - cards
      summary: list card operations
      operationId: getOperations
      parameters:
      - name: resourceType
        in: query
        schema:
          type: string
      responses:
        "200":
          description: the card operation list
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/CardOperationDTO"
    post:
      tags:
      - cards
      summary: create a card operation
      operationId: createCardOperation
      responses:
        "200":
          description: the card operation
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CardOperationAdminDTO"
      security:
      - oauth2:
        - admin:write:cardoperations
  /v1/card-operations/{cardId}:
    delete:
      tags:
      - cards
      summary: delete a card operation
      operationId: deleteCardOperation
      parameters:
      - name: cardId
        in: path
        required: true
        schema:
          type: string
      responses:
        "200":
          description: the deletion acknowledge
          content:
            application/json: {}
      security:
      - oauth2:
        - admin:write:cardoperations
    patch:
      tags:
      - cards
      summary: update a card operation
      operationId: updateCardOperation
      parameters:
      - name: cardId
        in: path
        required: true
        schema:
          type: string
      responses:
        "200":
          description: the card operation
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CardOperationAdminDTO"
      security:
      - oauth2:
        - admin:write:cardoperations
  /v1/card-operations/{cardOperationId}:
    get:
      tags:
      - cards
      summary: get a single card operation
      operationId: getOperation
      parameters:
      - name: cardOperationId
        in: path
        required: true
        schema:
          type: string
      responses:
        "200":
          description: the card operation
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CardOperationDTO"
  /v1/companies:
    post:
      tags:
      - companies
      summary: creates a company (M2M only)
      description: Creates a new company. This endpoint is M2M only. The user external
        ID must be provided in the request body.
      operationId: createCompany
      requestBody:
        description: the company payload required for the creation
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateCompanyBody"
        required: true
      responses:
        "200":
          description: the created company
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CompanyDTO"
        "400":
          description: "Missing or invalid parameters (userExternalId, name, domains)"
        "401":
          description: Unauthorized - M2M token required
        "404":
          description: User not found
      security:
      - oauth2:
        - write:company
  /v1/companies/{companyId}:
    get:
      tags:
      - companies
      summary: get a single company
      operationId: getCompany
      parameters:
      - name: companyId
        in: path
        required: true
        schema:
          type: string
      responses:
        "200":
          description: the requested company
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CompanyDTO"
      security:
      - oauth2:
        - read:company
    delete:
      tags:
      - companies
      summary: delete a single company (M2M only)
      description: Deletes a company by its external ID. This endpoint is M2M only.
      operationId: deleteCompany
      parameters:
      - name: companyId
        in: path
        required: true
        schema:
          type: string
      responses:
        "200":
          description: company successfully deleted
        "401":
          description: Unauthorized - M2M token required
        "404":
          description: company not found
      security:
      - oauth2:
        - write:company
    patch:
      tags:
      - companies
      summary: patch a company
      operationId: patchCompany
      parameters:
      - name: companyId
        in: path
        required: true
        schema:
          type: string
      requestBody:
        description: Fields to update on the target company
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UpsertCompany"
        required: true
      responses:
        "200":
          description: the updated company
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CompanyDTO"
        "400":
          description: invalid request
        "404":
          description: company not found
      security:
      - oauth2:
        - write:company
  /v1/companies/{companyId}/administrative-data:
    get:
      tags:
      - companies
      summary: get a company administrative data
      operationId: getCompanyAdministrativeData
      parameters:
      - name: companyId
        in: path
        required: true
        schema:
          type: string
      responses:
        "200":
          description: the company administrative data
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CompanyAdministrativeDataDTO"
      security:
      - oauth2:
        - read:administrative
    patch:
      tags:
      - companies
      summary: get a company administrative data
      operationId: updateCompanyAdministrativeData
      parameters:
      - name: companyId
        in: path
        required: true
        schema:
          type: string
      responses:
        "200":
          description: the company administrative data
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CompanyAdministrativeDataDTO"
        "404":
          description: User not found
        "500":
          description: Internal server error
      security:
      - oauth2:
        - write:administrative
  /v1/companies/{companyId}/workspaces:
    get:
      tags:
      - companies
      summary: get the workspaces belonging to the current company
      operationId: getCompanyWorkspaces
      parameters:
      - name: companyId
        in: path
        required: true
        schema:
          type: string
      - name: q
        in: query
        schema:
          type: string
      responses:
        "200":
          description: the list of workspaces
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/WorkspaceDTO"
      security:
      - oauth2:
        - read:companyworkspaces
  /v1/companies/accept-invite:
    post:
      tags:
      - companies
      summary: accepts the pending company-invite for the current user
      operationId: acceptInvite
      responses:
        "200":
          description: the accepted-invite confirmation
  /v1/companies/{companyId}/delete-invite/{inviteId}:
    delete:
      tags:
      - companies
      summary: deletes a company-invite
      operationId: deleteInvite
      parameters:
      - name: companyId
        in: path
        required: true
        schema:
          type: string
      - name: inviteId
        in: path
        required: true
        schema:
          type: string
      responses:
        "200":
          description: the invite removal confirmation
      security:
      - oauth2:
        - write:companyinvite
  /v1/companies/{companyId}/invite:
    post:
      tags:
      - companies
      summary: "creates a company-invite for the supplied user. When the invitation\
        \ is created, an email will be automatically dispatched to the invited user"
      operationId: invite
      parameters:
      - name: companyId
        in: path
        required: true
        schema:
          type: string
      requestBody:
        description: the email address of the user to invite
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CompanyInviteRequest"
        required: true
      responses:
        "200":
          description: the invite info
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CompanyInviteDTO"
      security:
      - oauth2:
        - write:companyinvite
  /v1/companies/{companyId}/list-invite:
    get:
      tags:
      - companies
      summary: returns the invites for the provided company
      operationId: listInvites
      parameters:
      - name: companyId
        in: path
        required: true
        schema:
          type: string
      responses:
        "200":
          description: the invite list
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/PaginatedCompanyInvite"
      security:
      - oauth2:
        - read:companyinvite
  /v1/companies/{companyId}/send-invite-email/{inviteId}:
    get:
      tags:
      - companies
      summary: "send a company-invitation email. Typically an email is automatically\
        \ sent at the end of the invitation process, this endpoint should be used\
        \ only to trigger an additional dispatch in case the first message got lost."
      operationId: sendEmail
      parameters:
      - name: companyId
        in: path
        required: true
        schema:
          type: string
      - name: inviteId
        in: path
        required: true
        schema:
          type: string
      responses:
        "200":
          description: the dispatch confirmation
      security:
      - oauth2:
        - read:companyinvite
  /v1/connectors/{id}:
    get:
      tags:
      - connectors
      summary: Get single connector by ID
      operationId: getConnector
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
      responses:
        "200":
          description: Connector details
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ConnectorDTO"
        "404":
          description: Connector not found
      security:
      - oauth2:
        - read:channels
  /v1/connectors/translations:
    get:
      tags:
      - connectors
      summary: Get connector translations
      description: Returns all connector i18n translation keys with their localized
        values
      operationId: getTranslations
      responses:
        "200":
          description: "Translation map keyed by i18n key, each value containing language\
            \ codes to translated strings"
      security:
      - oauth2:
        - read:channels
  /v1/connectors/oauth/callback:
    get:
      tags:
      - connectors
      summary: OAuth callback handler
      description: Handle OAuth callback and complete connector instance creation
      operationId: handleOAuthCallback
      parameters:
      - name: code
        in: query
        schema:
          type: string
      - name: state
        in: query
        schema:
          type: string
      - name: error
        in: query
        schema:
          type: string
      responses:
        "200":
          description: OAuth callback processed and connector instance created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ConnectorInstanceSafeDTO"
        "400":
          description: Invalid OAuth callback or state expired
  /v1/connectors:
    get:
      tags:
      - connectors
      summary: List all platform connectors
      operationId: listConnectors
      responses:
        "200":
          description: List of all available connectors
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/ConnectorDTO"
      security:
      - oauth2:
        - read:channels
  /v1/workspace/{workspaceId}/connectorflow/instance/{id}/jobs:
    get:
      tags:
      - connector-job-status
      summary: Get job status history for a connector flow instance
      operationId: getJobHistory
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      - name: id
        in: path
        required: true
        schema:
          type: string
      - name: limit
        in: query
        schema:
          type: integer
          format: int32
          default: 50
      - name: offset
        in: query
        schema:
          type: integer
          format: int32
          default: 0
      responses:
        "200":
          description: Job status history
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/ConnectorFlowInstanceJobStatusDTO"
        "404":
          description: Connector flow instance not found
      security:
      - oauth2:
        - read:channels
    post:
      tags:
      - connector-job-status
      summary: Record connector flow instance job status (M2M only)
      description: Records the result of a connector job execution. This endpoint
        is M2M only.
      operationId: recordJobStatus
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      - name: id
        in: path
        required: true
        schema:
          type: string
      requestBody:
        description: Job status data
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/RecordJobStatusRequest"
        required: true
      responses:
        "200":
          description: Job status recorded
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ConnectorFlowInstanceJobStatusDTO"
        "401":
          description: Unauthorized - M2M token required
        "404":
          description: Connector flow instance not found
      security:
      - oauth2:
        - write:channels
  /v1/workspace/{workspaceId}/connectorflow/jobs:
    get:
      tags:
      - connector-job-status
      summary: Get latest job status per connector flow instance
      description: Returns the most recent job status for each connector flow instance
        in the workspace. Optionally filter by audience and/or connector instance.
      operationId: getLatestJobStatuses
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      - name: audienceId
        in: query
        schema:
          type: string
      - name: connectorInstanceId
        in: query
        schema:
          type: string
      responses:
        "200":
          description: Latest job statuses
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/ConnectorFlowInstanceJobStatusDTO"
      security:
      - oauth2:
        - read:channels
  /v1/public/connectorflow/jobs/webhook:
    post:
      tags:
      - connector-job-status
      summary: Webhook for connector job status feedback
      description: Receives job status feedback from a connector via webhook. Recovers
        the existing job status by jobId to obtain workspace and flow instance context.
        Uses the connector flow implementation to parse the payload into a JobResult.
      operationId: webhookJobStatus
      parameters:
      - name: jobId
        in: query
        schema:
          type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/JsonNode"
      responses:
        "200":
          description: Job status recorded from webhook
        "404":
          description: Job status not found for the given jobId
  /v1/workspace/{workspaceId}/connectors/instance:
    get:
      tags:
      - workspace-connectors
      summary: List connector instances (no credentials)
      operationId: listConnectorInstances
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      responses:
        "200":
          description: List of connector instances without credentials
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/ConnectorInstanceSafeDTO"
      security:
      - oauth2:
        - read:channels
    post:
      tags:
      - workspace-connectors
      summary: Create connector instance
      description: "Create a connector instance. For OAuth connectors, returns AuthResponse\
        \ with redirect URL. For direct auth, creates instance immediately."
      operationId: createConnectorInstance
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      requestBody:
        description: Connector instance creation request
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateConnectorInstanceRequest"
        required: true
      responses:
        "200":
          description: Connector instance created successfully or OAuth flow initiated
          content:
            application/json:
              schema:
                oneOf:
                - $ref: "#/components/schemas/ConnectorInstanceSafeDTO"
                - $ref: "#/components/schemas/AuthResponse"
        "400":
          description: Invalid request or connector instance already exists
        "404":
          description: Connector not found
      security:
      - oauth2:
        - write:channels
  /v1/workspace/{workspaceId}/connectorflow/{id}/instance:
    post:
      tags:
      - workspace-connectors
      summary: Create connector flow instance
      operationId: createFlowInstance
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      - name: id
        in: path
        required: true
        schema:
          type: string
      requestBody:
        description: Flow instance creation request with params and mappings
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateFlowInstanceRequest"
        required: true
      responses:
        "200":
          description: Connector flow instance created successfully
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ConnectorFlowInstanceDTO"
        "400":
          description: Invalid request
        "404":
          description: Connector flow or instance not found
      security:
      - oauth2:
        - write:channels
  /v1/workspace/{workspaceId}/connectorflow/instance/{id}:
    get:
      tags:
      - workspace-connectors
      summary: Get single connector flow instance
      description: Returns a specific connector flow instance by ID if it belongs
        to the workspace
      operationId: getConnectorFlowInstance
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      - name: id
        in: path
        required: true
        schema:
          type: string
      responses:
        "200":
          description: Connector flow instance details
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ConnectorFlowInstanceDTO"
        "404":
          description: Connector flow instance not found
      security:
      - oauth2:
        - read:channels
    delete:
      tags:
      - workspace-connectors
      summary: Delete connector flow instance
      description: Deletes a connector flow instance by external ID
      operationId: deleteConnectorFlowInstance
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      - name: id
        in: path
        required: true
        schema:
          type: string
      responses:
        "204":
          description: Connector flow instance deleted successfully
        "404":
          description: Connector flow instance not found
      security:
      - oauth2:
        - write:channels
  /v1/workspace/{workspaceId}/connectors/instance/{id}:
    get:
      tags:
      - workspace-connectors
      summary: Get connector instance (no credentials)
      operationId: getConnectorInstance
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      - name: id
        in: path
        required: true
        schema:
          type: string
      responses:
        "200":
          description: Connector instance without credentials
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ConnectorInstanceSafeDTO"
        "404":
          description: Connector instance not found
      security:
      - oauth2:
        - read:channels
    delete:
      tags:
      - workspace-connectors
      summary: Delete connector instance (deauthenticate)
      description: "Deletes a connector instance, effectively deauthenticating the\
        \ connection. This will also deactivate all associated flow instances."
      operationId: deleteConnectorInstance
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      - name: id
        in: path
        required: true
        schema:
          type: string
      - name: force
        in: query
        schema:
          type: boolean
          default: false
      responses:
        "204":
          description: Connector instance deleted successfully
        "404":
          description: Connector instance not found
        "409":
          description: Cannot delete instance with active flows (provide ?force=true
            to override)
        "500":
          description: Internal server error
      security:
      - oauth2:
        - write:channels
  /v1/workspace/{workspaceId}/connectorflow/{id}:
    get:
      tags:
      - workspace-connectors
      summary: Get connector flow without config
      operationId: getConnectorFlow
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      - name: id
        in: path
        required: true
        schema:
          type: string
      responses:
        "200":
          description: Connector flow details
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ConnectorFlowDTO"
        "404":
          description: Connector flow not found
      security:
      - oauth2:
        - read:channels
  /v1/workspace/{workspaceId}/connectorflow/instance/{id}/creds:
    get:
      tags:
      - workspace-connectors
      summary: Get single connector flow instance (internal)
      description: Returns a specific connector flow instance by ID if it belongs
        to the workspace (internal)
      operationId: getConnectorFlowInstanceCreds
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      - name: id
        in: path
        required: true
        schema:
          type: string
      responses:
        "200":
          description: Connector flow instance details
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ConnectorFlowInstanceDTO"
        "404":
          description: Connector flow instance not found
      security:
      - oauth2:
        - read:channels
  /v1/workspace/{workspaceId}/connectors/instance/{id}/creds:
    get:
      tags:
      - workspace-connectors
      summary: Get connector instance with credentials (internal)
      operationId: getConnectorInstanceWithCredentials
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      - name: id
        in: path
        required: true
        schema:
          type: string
      responses:
        "200":
          description: Connector instance with credentials
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ConnectorInstanceDTO"
        "404":
          description: Connector instance not found
      security:
      - oauth2:
        - write:channels
    patch:
      tags:
      - workspace-connectors
      summary: Update connector instance credentials (internal)
      description: Updates the encrypted credentials for a connector instance. This
        endpoint is M2M only. The request body is a free-form JSON object containing
        the credentials.
      operationId: updateConnectorInstanceCredentials
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      - name: id
        in: path
        required: true
        schema:
          type: string
      requestBody:
        description: Free-form JSON object containing the credentials to be encrypted
          and stored
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/JsonNode"
        required: true
      responses:
        "204":
          description: Credentials updated successfully
        "400":
          description: Invalid request or missing credentials
        "401":
          description: Unauthorized - M2M token required
        "404":
          description: Connector instance not found
        "500":
          description: Internal server error
      security:
      - oauth2:
        - write:channels
  /v1/workspace/{workspaceId}/connectors/{id}:
    get:
      tags:
      - workspace-connectors
      summary: Get single connector for workspace
      description: Returns connector details if available to this workspace (public
        or workspace-specific private)
      operationId: getWorkspaceConnector
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      - name: id
        in: path
        required: true
        schema:
          type: string
      responses:
        "200":
          description: Connector details
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ConnectorDTO"
        "404":
          description: Connector not found
      security:
      - oauth2:
        - read:channels
  /v1/workspace/{workspaceId}/connectorflow/instance:
    get:
      tags:
      - workspace-connectors
      summary: List all connector flow instances in workspace
      description: Returns all connector flow instances in the workspace
      operationId: listConnectorFlowInstances
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      - name: audienceId
        in: query
        schema:
          type: string
          nullable: true
      responses:
        "200":
          description: List of connector flow instances
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/ConnectorFlowInstanceDTO"
      security:
      - oauth2:
        - read:channels
  /v1/workspace/{workspaceId}/connectorflow:
    get:
      tags:
      - workspace-connectors
      summary: List available connector flows
      operationId: listConnectorFlows
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      - name: showUserJourney
        in: query
        schema:
          type: boolean
          default: false
      responses:
        "200":
          description: List of available connector flows
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/ConnectorFlowDTO"
      security:
      - oauth2:
        - read:channels
  /v1/workspace/{workspaceId}/connectors:
    get:
      tags:
      - workspace-connectors
      summary: List available connectors for workspace
      description: Returns connectors available to this workspace (public connectors
        + workspace-specific private connectors)
      operationId: listWorkspaceConnectors
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      responses:
        "200":
          description: List of available connectors
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/ConnectorDTO"
      security:
      - oauth2:
        - read:channels
  /v1/workspace/{workspaceId}/connectorflow/{id}/prepare:
    get:
      tags:
      - workspace-connectors
      summary: Get connector flow with populated config
      operationId: prepareConnectorFlow
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      - name: id
        in: path
        required: true
        schema:
          type: string
      - name: audienceId
        in: query
        schema:
          type: string
      responses:
        "200":
          description: Connector flow with populated configuration
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ConnectorFlowDTO"
        "404":
          description: Connector flow not found
      security:
      - oauth2:
        - read:channels
  /v1/workspace/{workspaceId}/connectorflow/{id}/prepare/{stepId}:
    post:
      tags:
      - workspace-connectors
      summary: Prepare a specific step in a multi-step connector flow
      description: Prepares a specific step in a multi-step connector flow configuration
        by passing params from a previous step
      operationId: prepareConnectorFlowStep
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      - name: id
        in: path
        required: true
        schema:
          type: string
      - name: stepId
        in: path
        required: true
        schema:
          type: string
      - name: audienceId
        in: query
        schema:
          type: string
      requestBody:
        description: Parameters from previous step
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/PrepareFlowStepRequest"
        required: true
      responses:
        "200":
          description: Connector flow step prepared successfully
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ConnectorFlowDTO"
        "400":
          description: Invalid request
        "404":
          description: Connector flow not found
      security:
      - oauth2:
        - write:channels
  /v1/workspaces/{workspaceId}/datasources/{datasourceId}/status:
    get:
      tags:
      - datasources
      operationId: getDatasourceStatus
      parameters:
      - name: datasourceId
        in: path
        required: true
        schema:
          type: string
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      responses:
        default:
          description: default response
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/DataSourceStatus"
      security:
      - oauth2:
        - read:datasource
    put:
      tags:
      - datasources
      operationId: activate
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      - name: datasourceId
        in: path
        required: true
        schema:
          type: string
      responses:
        default:
          description: default response
          content:
            '*/*': {}
      security:
      - oauth2:
        - admin:activate:datasource
  /v1/workspaces/{workspaceId}/datasources/{datasourceId}/authenticated:
    post:
      tags:
      - datasources
      summary: update the datasource status to authenticated
      description: updates the current status of the datasource and continues the
        setup
      operationId: authenticated
      parameters:
      - name: datasourceId
        in: path
        required: true
        schema:
          type: string
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      responses:
        "200":
          description: the updated datasource
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CreateUpdateDataSourceResponse"
      security:
      - oauth2:
        - write:datasource
  /v1/workspaces/{workspaceId}/datasources/count:
    get:
      tags:
      - datasources
      summary: "Counts the data-sources for a workspace, optionally filtered by query"
      operationId: countDataSources
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      - name: status
        in: query
        description: "Filter by datasource status. If not specified, data sources\
          \ with a status different from CONFIGURATION_REQUIRED will be returned."
        schema:
          type: string
          enum:
          - CONFIGURATION_REQUIRED
          - PENDING
          - ACTIVATING
          - ACTIVE
          - INACTIVE
          - ERROR
      - name: q
        in: query
        schema:
          type: string
      responses:
        "200":
          description: number of data-sources
          content:
            application/json:
              schema:
                type: integer
                format: int64
      security:
      - oauth2:
        - read:datasource
  /v1/workspaces/{workspaceId}/datasources/{datasourceId}/presignedurl:
    post:
      tags:
      - datasources
      summary: creates a presigned url for downloading the datasource's CSV
      operationId: createPreSignedUrl
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      - name: datasourceId
        in: path
        required: true
        schema:
          type: string
      responses:
        "200":
          description: the url for downloading the file
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/PresignedUrl"
      security:
      - oauth2:
        - write:datasource
  /v1/workspaces/{workspaceId}/datasources/{datasourceId}:
    get:
      tags:
      - datasources
      summary: retrieves a single data-source
      operationId: getDataSource
      parameters:
      - name: datasourceId
        in: path
        required: true
        schema:
          type: string
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      responses:
        "200":
          description: the data-source
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/DataSourceDTO"
      security:
      - oauth2:
        - read:datasource
    delete:
      tags:
      - datasources
      operationId: delete_1
      parameters:
      - name: datasourceId
        in: path
        required: true
        schema:
          type: string
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      responses:
        default:
          description: default response
          content:
            application/json: {}
      security:
      - oauth2:
        - write:datasource
    patch:
      tags:
      - datasources
      summary: updates a single datasource
      operationId: update_1
      parameters:
      - name: datasourceId
        in: path
        required: true
        schema:
          type: string
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UpdateDataSourceBody"
      responses:
        "200":
          description: the updated datasource
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/DataSourceDTO"
      security:
      - oauth2:
        - write:datasource
  /v1/workspaces/{workspaceId}/datasources/{datasourceId}/setup:
    get:
      tags:
      - datasources
      operationId: getConfig
      parameters:
      - name: datasourceId
        in: path
        required: true
        schema:
          type: string
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      responses:
        default:
          description: default response
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/DataSourceSetup"
      security:
      - oauth2:
        - read:datasource
  /v1/workspaces/{workspaceId}/datasources/{datasourceId}/csv/stats:
    get:
      tags:
      - datasources
      summary: get the datasource stats for csv ingestion
      operationId: getDataSourceCSVStats
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      - name: datasourceId
        in: path
        required: true
        schema:
          type: string
      responses:
        "200":
          description: the datasource CSV stats
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/DataSourceCSVStatsDTO"
      security:
      - oauth2:
        - read:datasource
  /v1/workspaces/{workspaceId}/datasources/{datasourceId}/events:
    get:
      tags:
      - datasources
      summary: get a limited list of the last events received
      operationId: getDataSourceEvents
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      - name: datasourceId
        in: path
        required: true
        schema:
          type: string
      - name: limit
        in: query
        schema:
          type: integer
          format: int32
          default: 10
      - name: offset
        in: query
        schema:
          type: integer
          format: int32
          default: 0
      responses:
        "200":
          description: the list of the events
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/EventDTO"
      security:
      - oauth2:
        - read:datasource
  /v1/workspaces/{workspaceId}/datasources/{datasourceId}/stats:
    get:
      tags:
      - datasources
      operationId: getDataSourceStats
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      - name: datasourceId
        in: path
        required: true
        schema:
          type: string
      - name: traitId
        in: query
        schema:
          type: string
      responses:
        default:
          description: default response
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/DataSourceStats"
      security:
      - oauth2:
        - read:datasource
  /v1/workspaces/{workspaceId}/datasources/multi:
    get:
      tags:
      - datasources
      summary: retrieves multiple data-sources
      operationId: getDataSources
      parameters:
      - name: datasourceId
        in: query
        schema:
          type: array
          items:
            type: string
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      responses:
        "200":
          description: the list of data-sources
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/DataSourceList"
      security:
      - oauth2:
        - read:datasource
  /v1/workspaces/{workspaceId}/datasources:
    get:
      tags:
      - datasources
      summary: retrieves a list of data-sources
      operationId: getDataSources_1
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      - name: limit
        in: query
        schema:
          type: integer
          format: int32
          default: 50
      - name: offset
        in: query
        schema:
          type: integer
          format: int32
          default: 0
      - name: status
        in: query
        schema:
          type: string
          enum:
          - CONFIGURATION_REQUIRED
          - PENDING
          - ACTIVATING
          - ACTIVE
          - INACTIVE
          - ERROR
      - name: q
        in: query
        schema:
          type: string
      responses:
        "200":
          description: the list of data-sources
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/PagedDataSources"
      security:
      - oauth2:
        - read:datasource
    post:
      tags:
      - datasources
      summary: insert a datasource
      operationId: insert
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/InsertDataSourceBody"
        required: true
      responses:
        "200":
          description: the datasource created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CreateUpdateDataSourceResponse"
      security:
      - oauth2:
        - write:datasource
  /v1/workspaces/{workspaceId}/datasources/{datasourceId}/dependencies:
    get:
      tags:
      - datasources
      summary: get the dependencies of a datasource
      operationId: getDependencies
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      - name: datasourceId
        in: path
        required: true
        schema:
          type: string
      responses:
        "200":
          description: the dependencies
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/DataSourceDependencies"
      security:
      - oauth2:
        - read:datasource
  /v1/workspaces/{workspaceId}/datasources/{datasourceId}/lines:
    get:
      tags:
      - datasources
      summary: get the first lines of the file uploaded in the datasource
      operationId: getFileLines
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      - name: datasourceId
        in: path
        required: true
        schema:
          type: string
      - name: limit
        in: query
        schema:
          maximum: 100
          minimum: 10
          type: integer
          format: int32
          default: 50
      responses:
        "200":
          description: the first lines of the file
          content:
            application/json:
              schema:
                type: array
                items:
                  type: string
      security:
      - oauth2:
        - read:datasource
  /v1/workspaces/{workspaceId}/datasources/custom-properties:
    get:
      tags:
      - datasources
      summary: "get the custom properties for multiple data-sources, fetched from\
        \ the configuration and the event database"
      operationId: getMultipleProperties
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      - name: datasourceIds
        in: query
        schema:
          type: array
          items:
            type: string
      responses:
        "200":
          description: the list of custom properties
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/DataSourceCustomProperties"
      security:
      - oauth2:
        - read:datasource
  /v1/workspaces/{workspaceId}/datasources/{datasourceId}/custom-properties:
    get:
      tags:
      - datasources
      summary: "get the custom properties of a datasource, fetched from the configuration\
        \ and the event database"
      operationId: getProperties
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      - name: datasourceId
        in: path
        required: true
        schema:
          type: string
      responses:
        "200":
          description: the list of custom properties
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/DataSourceCustomProperties"
      security:
      - oauth2:
        - read:datasource
  /v1/workspaces/{workspaceId}/datasources/{datasourceId}/trait-distributions:
    get:
      tags:
      - datasources
      summary: get the trait distributions for a datasource
      operationId: getTraitDistributions_1
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      - name: datasourceId
        in: path
        required: true
        schema:
          type: string
      responses:
        "200":
          description: the list of traits with their distribution count and totals
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/DataSourceTraitDistributions"
      security:
      - oauth2:
        - read:datasource
  /v1/workspaces/{workspaceId}/datasources/trait-distributions:
    get:
      tags:
      - datasources
      summary: get the trait distributions for multiple data-sources
      operationId: getTraitDistributionsByDataSourceIds
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      - name: datasourceIds
        in: query
        schema:
          type: array
          items:
            type: string
      responses:
        "200":
          description: a list of datasource trait distributions
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/DataSourceTraitDistributions"
      security:
      - oauth2:
        - read:datasource
  /v1/workspaces/{workspaceId}/datasources/{datasourceId}/{type}/resync:
    post:
      tags:
      - datasources
      summary: resync file
      operationId: resync
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      - name: datasourceId
        in: path
        required: true
        schema:
          type: string
      - name: type
        in: path
        description: Storage type
        required: true
        schema:
          pattern: sftp|s3
          type: string
          enum:
          - sftp
          - s3
      responses:
        default:
          description: default response
          content:
            application/json: {}
      security:
      - oauth2:
        - write:datasource
  /v1/workspaces/{workspaceId}/datasources/{datasourceId}/csv/{txId}/retry:
    post:
      tags:
      - datasources
      summary: retry ingest all rows
      operationId: retryCSV
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      - name: datasourceId
        in: path
        required: true
        schema:
          type: string
      - name: txId
        in: path
        required: true
        schema:
          type: string
      responses:
        default:
          description: default response
          content:
            application/json: {}
      security:
      - oauth2:
        - write:datasource
  /v1/workspaces/{workspaceId}/datasources/{datasourceId}/csv/{txId}/retry-ingestion:
    post:
      tags:
      - datasources
      summary: retry ingest the rows that caused an ingestion error
      operationId: retryCSVIngestion
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      - name: datasourceId
        in: path
        required: true
        schema:
          type: string
      - name: txId
        in: path
        required: true
        schema:
          type: string
      responses:
        default:
          description: default response
          content:
            application/json: {}
      security:
      - oauth2:
        - write:datasource
  /v1/workspaces/{workspaceId}/datasources/{datasourceId}/update-fields:
    put:
      tags:
      - datasources
      summary: updates the value of fields
      operationId: updateParameters
      parameters:
      - name: datasourceId
        in: path
        required: true
        schema:
          type: string
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CyclrUpdateFieldsBody"
      responses:
        "200":
          description: the updated datasource
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CreateUpdateDataSourceResponse"
      security:
      - oauth2:
        - write:datasource
  /v1/workspaces/{workspaceId}/datasources/{datasourceId}/update-parameters:
    put:
      tags:
      - datasources
      summary: updates the value of parameters
      operationId: updateParameters_1
      parameters:
      - name: datasourceId
        in: path
        required: true
        schema:
          type: string
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CyclrUpdateParametersBody"
      responses:
        "200":
          description: the updated datasource
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CreateUpdateDataSourceResponse"
      security:
      - oauth2:
        - write:datasource
  /v1/datasources/activate/website:
    put:
      tags:
      - datasources
      operationId: activate_1
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/DataSourceActivationBody"
      responses:
        default:
          description: default response
          content:
            '*/*': {}
      security:
      - oauth2:
        - admin:activate:datasource
  /v1/datasources/{datasourceId}/audiences:
    get:
      tags:
      - datasources
      operationId: getDataSourceAudiences
      parameters:
      - name: datasourceId
        in: path
        required: true
        schema:
          type: string
      responses:
        default:
          description: default response
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/AudienceConfigurationDTO"
      security:
      - oauth2:
        - admin:audiences:datasource
  /v1/datasources/{datasourceId}/rules:
    get:
      tags:
      - datasources
      operationId: getDataSourceRules
      parameters:
      - name: datasourceId
        in: path
        required: true
        schema:
          type: string
      responses:
        default:
          description: default response
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/DataSourceRulesDTO"
      security:
      - oauth2:
        - admin:rules:datasource
  /v1/datasources/{datasourceId}:
    get:
      tags:
      - datasources
      operationId: getDataSourceWithRules
      parameters:
      - name: datasourceId
        in: path
        required: true
        schema:
          type: string
      responses:
        default:
          description: default response
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/DataSourceWithRulesDTO"
      security:
      - oauth2:
        - admin:rules:datasource
  /v1/datasources:
    get:
      tags:
      - datasources
      operationId: getWorkspaceDataSourceWithRules
      parameters:
      - name: workspaceId
        in: query
        schema:
          type: string
      responses:
        default:
          description: default response
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/DataSourceWithRulesDTO"
      security:
      - oauth2:
        - admin:rules:datasource
  /v1/workspaces/{workspaceId}/datasources/{datasourceId}/rules:
    get:
      tags:
      - rules
      summary: get a list of data-sources' rules
      operationId: getRules
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      - name: datasourceId
        in: path
        required: true
        schema:
          type: string
      - name: includeDataSourceConfiguration
        in: query
        schema:
          type: integer
          format: int32
          default: 0
      - name: type
        in: query
        schema:
          type: string
          enum:
          - TRACK
          - VIEW
          - CUSTOM
      responses:
        "200":
          description: the list of rules
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/DatasourceRuleList"
      security:
      - oauth2:
        - read:rule
    post:
      tags:
      - rules
      summary: create an datasource's rules
      operationId: createRule
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      - name: datasourceId
        in: path
        required: true
        schema:
          type: string
      responses:
        "200":
          description: the created rules
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CreateDatasourceRulesBody"
      security:
      - oauth2:
        - write:rule
  /v1/workspaces/{workspaceId}/datasources/{datasourceId}/rules/{ruleId}:
    get:
      tags:
      - rules
      summary: get a single datasource rule
      operationId: getRule
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      - name: datasourceId
        in: path
        required: true
        schema:
          type: string
      - name: ruleId
        in: path
        required: true
        schema:
          type: string
      responses:
        "200":
          description: the rule
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/DataSourceRuleDTO"
      security:
      - oauth2:
        - read:rule
    delete:
      tags:
      - rules
      summary: delete a single datasource rule
      operationId: deleteRule
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      - name: datasourceId
        in: path
        required: true
        schema:
          type: string
      - name: ruleId
        in: path
        required: true
        schema:
          type: string
      responses:
        "200":
          description: the confirmation of deletion
          content:
            application/json: {}
      security:
      - oauth2:
        - write:audience
    patch:
      tags:
      - rules
      summary: update a datasource rule
      operationId: updateRule
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      - name: datasourceId
        in: path
        required: true
        schema:
          type: string
      - name: ruleId
        in: path
        required: true
        schema:
          type: string
      responses:
        "200":
          description: the updated rule
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/DataSourceRuleDTO"
      security:
      - oauth2:
        - write:audience
  /v1/datasources/types:
    get:
      tags:
      - datasources
      summary: List datasource types
      description: Returns available datasource types together with their persisted
        configuration data.
      operationId: getTypes
      parameters:
      - name: limit
        in: query
        description: Maximum number of datasource types to return
        schema:
          type: integer
          format: int32
          default: 50
        example: 50
      - name: offset
        in: query
        description: Number of datasource types to skip before returning results
        schema:
          type: integer
          format: int32
          default: 0
        example: 0
      responses:
        "200":
          description: List of datasource types with persisted configuration data
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/DataSourceTypeDTO"
      security:
      - oauth2:
        - read:datasource
  /v1/workspaces/{workspaceId}/datasourcesrules:
    get:
      tags:
      - rules
      summary: get a list of all the rules
      operationId: getRules_1
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      - name: type
        in: query
        schema:
          type: string
          enum:
          - TRACK
          - VIEW
          - CUSTOM
      - name: datasourceIds
        in: query
        schema:
          type: string
      responses:
        "200":
          description: the list of rules
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/DatasourceRuleList"
      security:
      - oauth2:
        - read:rule
  /v1/workspaces/{workspaceId}/audiences/{audienceId}/distribution-channels/{distributionChannelId}/activate:
    post:
      tags:
      - distribution-channels
      summary: Activate a distribution channel
      description: "Activates the Cyclr cycle associated with this distribution channel,\
        \ enabling automatic audience syncing to the destination platform."
      operationId: activateDistributionChannel
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      - name: audienceId
        in: path
        required: true
        schema:
          type: string
      - name: distributionChannelId
        in: path
        required: true
        schema:
          type: string
      responses:
        "200":
          description: Channel activated
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CreateUpdateDistributionChannelResponse"
        "400":
          description: Integration partner not supported for this operation
        "404":
          description: "Workspace, audience, or distribution channel not found"
        "500":
          description: Invalid configuration or activation failed
      security:
      - oauth2:
        - write:channels
  /v1/workspaces/{workspaceId}/audiences/{audienceId}/distribution-channels/{distributionChannelId}/authenticated:
    post:
      tags:
      - distribution-channels
      summary: Confirm connector authentication
      description: Called after the user completes OAuth authentication for a Cyclr
        connector. Verifies the authentication status with Cyclr and updates the channel
        configuration accordingly.
      operationId: authenticateDistributionChannel
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      - name: audienceId
        in: path
        required: true
        schema:
          type: string
      - name: distributionChannelId
        in: path
        required: true
        schema:
          type: string
      responses:
        "200":
          description: "Authentication confirmed, channel configuration updated"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CreateUpdateDistributionChannelResponse"
        "400":
          description: Integration partner not supported for this operation
        "404":
          description: "Workspace, audience, or distribution channel not found"
        "500":
          description: Authentication verification failed or configuration update
            failed
      security:
      - oauth2:
        - write:channels
  /v1/workspaces/{workspaceId}/audiences/{audienceId}/distribution-channels:
    get:
      tags:
      - distribution-channels
      summary: List distribution channels for an audience
      description: "Returns all distribution channels configured for the specified\
        \ audience, excluding those still in configuration-required status."
      operationId: getAudienceDistributionChannels
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      - name: audienceId
        in: path
        required: true
        schema:
          type: string
      responses:
        "200":
          description: List of distribution channels
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/DistributionChannelDTO"
        "404":
          description: Workspace or audience not found
      security:
      - oauth2:
        - read:channels
    post:
      tags:
      - distribution-channels
      summary: Create a distribution channel
      description: Creates a new distribution channel for the audience by installing
        a Cyclr template. The channel starts in CONFIGURATION_REQUIRED status and
        must be configured before activation.
      operationId: createDistributionChannel
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      - name: audienceId
        in: path
        required: true
        schema:
          type: string
      requestBody:
        description: Integration partner and Cyclr template configuration
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateDistributionChannelBody"
        required: true
      responses:
        "200":
          description: Created distribution channel with integration result
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CreateUpdateDistributionChannelResponse"
        "400":
          description: Missing configuration or invalid request
        "404":
          description: Workspace or audience not found
        "500":
          description: Failed to create distribution channel or install Cyclr template
        "501":
          description: Integration partner not supported
      security:
      - oauth2:
        - write:channels
  /v1/workspaces/{workspaceId}/audiences/{audienceId}/distribution-channels/{distributionChannelId}/deactivate:
    post:
      tags:
      - distribution-channels
      summary: Deactivate a distribution channel
      description: "Stops the Cyclr cycle associated with this distribution channel,\
        \ pausing automatic audience syncing. The channel can be reactivated later."
      operationId: deactivateDistributionChannel
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      - name: audienceId
        in: path
        required: true
        schema:
          type: string
      - name: distributionChannelId
        in: path
        required: true
        schema:
          type: string
      responses:
        "200":
          description: Channel deactivated
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CreateUpdateDistributionChannelResponse"
        "400":
          description: Integration partner not supported for this operation
        "404":
          description: "Workspace, audience, or distribution channel not found"
        "500":
          description: Invalid configuration or deactivation failed
      security:
      - oauth2:
        - write:channels
  /v1/workspaces/{workspaceId}/audiences/{audienceId}/distribution-channels/{distributionChannelId}:
    get:
      tags:
      - distribution-channels
      summary: Get distribution channel details
      description: "Returns the full details of a specific distribution channel, including\
        \ its configuration, status, and sync settings."
      operationId: getAudienceDistributionChannel
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      - name: audienceId
        in: path
        required: true
        schema:
          type: string
      - name: distributionChannelId
        in: path
        required: true
        schema:
          type: string
      responses:
        "200":
          description: Distribution channel details
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/DistributionChannelDTO"
        "404":
          description: "Workspace, audience, or distribution channel not found"
      security:
      - oauth2:
        - read:channels
    delete:
      tags:
      - distribution-channels
      summary: Delete a distribution channel
      description: Deletes a distribution channel and its associated Cyclr cycle.
        The channel is soft-deleted and its configuration is removed from KeyVault.
      operationId: deleteDistributionChannel
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      - name: audienceId
        in: path
        required: true
        schema:
          type: string
      - name: distributionChannelId
        in: path
        required: true
        schema:
          type: string
      responses:
        "200":
          description: Distribution channel deleted successfully
        "404":
          description: "Workspace, audience, or distribution channel not found"
        "500":
          description: Failed to delete Cyclr cycle or distribution channel
      security:
      - oauth2:
        - write:channels
    patch:
      tags:
      - distribution-channels
      summary: Update distribution channel settings
      description: "Updates distribution channel sync settings (allowAddUsers, allowUpdateUsers,\
        \ allowRemoveUsers, traitId). Can optionally activate the channel in the same\
        \ request."
      operationId: updateDistributionChannel
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      - name: audienceId
        in: path
        required: true
        schema:
          type: string
      - name: distributionChannelId
        in: path
        required: true
        schema:
          type: string
      requestBody:
        description: Fields to update. Only provided fields will be changed.
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UpdateDistributionChannelBody"
        required: true
      responses:
        "200":
          description: Updated distribution channel
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CreateUpdateDistributionChannelResponse"
        "404":
          description: "Workspace, audience, or distribution channel not found"
        "500":
          description: Failed to update distribution channel
      security:
      - oauth2:
        - write:channels
  /v1/workspaces/{workspaceId}/audiences/{audienceId}/distribution-channels/{distributionChannelId}/last-cyclr-transaction:
    get:
      tags:
      - distribution-channels
      summary: Get last Cyclr sync transaction
      description: "Returns the most recent Cyclr transaction for this distribution\
        \ channel, including timestamp and error status. Useful for monitoring sync\
        \ health."
      operationId: getLastCyclrTransaction
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      - name: audienceId
        in: path
        required: true
        schema:
          type: string
      - name: distributionChannelId
        in: path
        required: true
        schema:
          type: string
      responses:
        "200":
          description: Last transaction details
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CyclrTransactionDTO"
        "404":
          description: "Workspace, audience, or distribution channel not found"
        "500":
          description: Invalid distribution channel configuration
      security:
      - oauth2:
        - read:channels
  /v1/workspaces/{workspaceId}/audiences/{audienceId}/distribution-channels/{distributionChannelId}/sync:
    post:
      tags:
      - distribution-channels
      summary: Trigger audience sync
      description: Triggers an immediate sync of the audience to the distribution
        channel destination. Uses the latest audience evaluation results.
      operationId: syncDistributionChannel
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      - name: audienceId
        in: path
        required: true
        schema:
          type: string
      - name: distributionChannelId
        in: path
        required: true
        schema:
          type: string
      responses:
        "200":
          description: Sync request queued successfully
        "404":
          description: "Workspace, audience, or distribution channel not found"
      security:
      - oauth2:
        - write:channels
  /v1/workspaces/{workspaceId}/audiences/{audienceId}/distribution-channels/{distributionChannelId}/update-fields:
    put:
      tags:
      - distribution-channels
      summary: Update Cyclr field mappings
      description: "Updates field mappings for the Cyclr cycle, allowing you to ignore\
        \ specific fields that should not be synced to the destination platform."
      operationId: updateFields
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      - name: audienceId
        in: path
        required: true
        schema:
          type: string
      - name: distributionChannelId
        in: path
        required: true
        schema:
          type: string
      requestBody:
        description: List of fields with their mapping types (currently only 'Ignore'
          is supported)
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CyclrUpdateFieldsBody"
        required: true
      responses:
        "200":
          description: Field mappings updated successfully
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CreateUpdateDistributionChannelResponse"
        "400":
          description: "Missing fields, unsupported mapping type, or integration partner\
            \ not supported"
        "404":
          description: "Workspace, audience, or distribution channel not found"
        "500":
          description: Failed to update field mappings
      security:
      - oauth2:
        - write:channels
  /v1/workspaces/{workspaceId}/audiences/{audienceId}/distribution-channels/{distributionChannelId}/update-parameters:
    put:
      tags:
      - distribution-channels
      summary: Update Cyclr step parameters
      description: "Updates the parameter values for Cyclr cycle steps (e.g., destination\
        \ list ID, segment name). These parameters configure where and how audience\
        \ data is sent."
      operationId: updateParameters_2
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      - name: audienceId
        in: path
        required: true
        schema:
          type: string
      - name: distributionChannelId
        in: path
        required: true
        schema:
          type: string
      requestBody:
        description: List of parameters to update with their new values
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CyclrUpdateParametersBody"
        required: true
      responses:
        "200":
          description: Parameters updated successfully
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CreateUpdateDistributionChannelResponse"
        "400":
          description: "Missing parameters, invalid request body, or integration partner\
            \ not supported"
        "404":
          description: "Workspace, audience, or distribution channel not found"
        "409":
          description: Distribution channel with same destination already exists for
            this audience
        "500":
          description: Failed to update parameters
      security:
      - oauth2:
        - write:channels
  /v1/workspaces/{workspaceId}/distribution-channels/connectors/deauthenticate:
    post:
      tags:
      - distribution-channels
      summary: deauthenticate a connector
      operationId: deauthenticateConnector
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/InstallAndAuthenticateConnectorRequestDTO"
        required: true
      responses:
        "200":
          description: the connector was deauthenticated
      security:
      - oauth2:
        - write:channels
  /v1/workspaces/{workspaceId}/distribution-channels/connectors:
    get:
      tags:
      - distribution-channels
      summary: retrieves the list of distribution channels connectors
      operationId: getDistributionChannelConnectors
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      responses:
        "200":
          description: the list of distribution channel connectors
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/DistributionChannelConnectorDTO"
      security:
      - oauth2:
        - read:channels
  /v1/workspaces/{workspaceId}/distribution-channels:
    get:
      tags:
      - distribution-channels
      summary: retrieves a list of distribution channels
      operationId: getDistributionChannels
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      - name: audienceIds
        in: query
        schema:
          type: string
      - name: limit
        in: query
        schema:
          type: integer
          format: int32
          default: 100
      - name: offset
        in: query
        schema:
          type: integer
          format: int32
          default: 0
      - name: q
        in: query
        schema:
          type: string
      responses:
        "200":
          description: the list of distribution channels
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/DistributionChannelDTO"
      security:
      - oauth2:
        - read:channels
  /v1/workspaces/{workspaceId}/distribution-channels/connectors/authenticate:
    post:
      tags:
      - distribution-channels
      summary: install and starts the authentication process for the connector
      operationId: installAndAuthenticateConnector
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/InstallAndAuthenticateConnectorRequestDTO"
        required: true
      responses:
        "200":
          description: connector info
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/InstallAndAuthenticateConnectorResponseDTO"
      security:
      - oauth2:
        - write:channels
  /v1/upload/tmp/presignedurl:
    post:
      tags:
      - files
      operationId: createPreSignedURL
      responses:
        default:
          description: default response
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/UploadResponse"
  /v1/upload/tmp:
    get:
      tags:
      - files
      operationId: getRows
      parameters:
      - name: workspaceId
        in: query
        schema:
          type: string
      - name: key
        in: query
        schema:
          type: string
      - name: limit
        in: query
        schema:
          type: integer
          format: int32
          default: 50
      responses:
        default:
          description: default response
          content:
            application/json:
              schema:
                type: array
                items:
                  type: string
  /v1/upload/s3/preview:
    post:
      tags:
      - files
      summary: Retrieve rows from S3
      description: Fetch a preview of rows stored in an S3 bucket based on the provided
        connection details.
      operationId: getS3Rows
      requestBody:
        description: Details of the S3 connection and query parameters.
        content:
          '*/*':
            schema:
              $ref: "#/components/schemas/FileS3TestConnectionBody"
        required: true
      responses:
        "200":
          description: List of rows fetched from S3
          content:
            application/json:
              schema:
                type: string
        "400":
          description: Invalid input or request body
          content:
            application/json: {}
        "500":
          description: Server error
          content:
            application/json: {}
  /v1/upload/sftp/preview:
    post:
      tags:
      - files
      summary: Retrieve rows from the SFTP
      description: Fetch a preview of rows stored in an SFTP server based on the provided
        connection details.
      operationId: getSFTPRows
      requestBody:
        description: Details of the SFTP connection and query parameters.
        content:
          '*/*':
            schema:
              $ref: "#/components/schemas/FileSFTPConnectionBody"
        required: true
      responses:
        "200":
          description: List of rows fetched from the SFTP
          content:
            application/json:
              schema:
                type: string
        "400":
          description: Invalid input or request body
          content:
            application/json: {}
        "500":
          description: Server error
          content:
            application/json: {}
  /v1/health/monitor:
    get:
      summary: Log database pool stats
      operationId: monitor
      responses:
        "200":
          description: Success
          content:
            application/json:
              example:
                monitor: ok
        "500":
          description: Internal Server Error
  /v1/health/ping:
    get:
      summary: Check if the service responds
      operationId: ping
      responses:
        "200":
          description: The service response
          content:
            application/json:
              example:
                health: ok
        "500":
          description: Internal Server Error
  /v1/health/ready:
    get:
      summary: Check if the service is ready
      operationId: ready
      responses:
        "200":
          description: The service is ready
          content:
            application/json:
              example:
                ready: ok
        "500":
          description: Internal Server Error
  /v1/workspaces/{workspaceId}/integrations/cyclr/templates:
    get:
      tags:
      - integrations
      summary: get all the available templates for a specific workspace
      operationId: getTemplates
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      responses:
        "200":
          description: the list of templates
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/Template"
  /v1/workspaces/{workspaceId}/market-intelligence/{reportId}:
    get:
      tags:
      - market-intelligence
      summary: Polling status and result of an analysis
      description: "Returns the current status and, when DONE, the full report."
      operationId: getResult
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      - name: reportId
        in: path
        required: true
        schema:
          type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/MarketIntelligenceResultDTO"
        "404":
          description: Report not found
      security:
      - oauth2:
        - read:mireport
    delete:
      tags:
      - market-intelligence
      summary: Delete a report
      operationId: deleteReport
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      - name: reportId
        in: path
        required: true
        schema:
          type: string
      responses:
        "204":
          description: Deleted
        "400":
          description: Analysis still in progress — cannot delete
        "404":
          description: Report not found
      security:
      - oauth2:
        - write:mireport
  /v1/workspaces/{workspaceId}/market-intelligence:
    get:
      tags:
      - market-intelligence
      summary: List of workspace reports
      operationId: listReports
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      - name: limit
        in: query
        schema:
          type: integer
          format: int32
          default: 10
      - name: offset
        in: query
        schema:
          type: integer
          format: int32
          default: 0
      - name: status
        in: query
        description: Filter by job status. Frontend uses status=DONE&limit=1 to fetch
          the latest successful report when the most recent run is in ERROR.
        schema:
          type: string
          enum:
          - PENDING
          - RUNNING_STEP1
          - RUNNING_STEP2
          - RUNNING_STEP3
          - DONE
          - ERROR
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/PagingObject"
      security:
      - oauth2:
        - read:mireport
  /v1/workspaces/{workspaceId}/market-intelligence/{reportId}/retry:
    post:
      tags:
      - market-intelligence
      summary: Retry a failed analysis
      description: Reuses the same reportId/jobId to re-run a report that is in ERROR.
        Only ERROR reports can be retried — PENDING/RUNNING/DONE return 400. The optional
        `language` query parameter overrides the report output language for the new
        run (the user's UI session language); when absent or invalid it defaults to
        English.
      operationId: retryReport
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      - name: reportId
        in: path
        required: true
        schema:
          type: string
      - name: language
        in: query
        schema:
          type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/MarketIntelligenceStartDTO"
        "400":
          description: Report is not in ERROR state
        "404":
          description: Report not found
        "409":
          description: Report was just retried or deleted by another request
      security:
      - oauth2:
        - write:mireport
  /v1/workspaces/{workspaceId}/market-intelligence/{jobId}/error:
    patch:
      tags:
      - market-intelligence
      summary: Persist error row (status ERROR)
      description: '**Requires a machine-to-machine token** (Auth0 `client_credentials`
        grant). Consumed by the market-intelligence worker; not intended for dashboard
        users.'
      operationId: saveError
      parameters:
      - name: jobId
        in: path
        required: true
        schema:
          type: string
          format: uuid
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/PipelineErrorBody"
      responses:
        default:
          description: default response
          content:
            '*/*': {}
      security:
      - oauth2:
        - write:mireport
  /v1/workspaces/{workspaceId}/market-intelligence/{jobId}/report:
    patch:
      tags:
      - market-intelligence
      summary: Persist final MarketReport and flip status to DONE
      description: '**Requires a machine-to-machine token** (Auth0 `client_credentials`
        grant). Consumed by the market-intelligence worker; not intended for dashboard
        users.'
      operationId: saveReport
      parameters:
      - name: jobId
        in: path
        required: true
        schema:
          type: string
          format: uuid
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/PipelineReportBody"
      responses:
        default:
          description: default response
          content:
            '*/*': {}
      security:
      - oauth2:
        - write:mireport
  /v1/workspaces/{workspaceId}/market-intelligence/analyze:
    post:
      tags:
      - market-intelligence
      summary: Start a market analysis
      operationId: startAnalysis
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/StartAnalysisBody"
      responses:
        "200":
          description: Job started
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/MarketIntelligenceStartDTO"
        "400":
          description: Invalid input
        "404":
          description: Workspace not found
      security:
      - oauth2:
        - write:mireport
  /v1/workspaces/{workspaceId}/market-intelligence/{jobId}/competitors:
    patch:
      tags:
      - market-intelligence
      summary: Persist STEP2 competitor search results
      description: '**Requires a machine-to-machine token** (Auth0 `client_credentials`
        grant). Consumed by the market-intelligence worker; not intended for dashboard
        users.'
      operationId: updateCompetitors
      parameters:
      - name: jobId
        in: path
        required: true
        schema:
          type: string
          format: uuid
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/PipelineCompetitorsBody"
      responses:
        default:
          description: default response
          content:
            '*/*': {}
      security:
      - oauth2:
        - write:mireport
  /v1/workspaces/{workspaceId}/market-intelligence/{jobId}/status:
    patch:
      tags:
      - market-intelligence
      summary: Advance job status
      description: '**Requires a machine-to-machine token** (Auth0 `client_credentials`
        grant). Consumed by the market-intelligence worker; not intended for dashboard
        users.'
      operationId: updateStatus
      parameters:
      - name: jobId
        in: path
        required: true
        schema:
          type: string
          format: uuid
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/PipelineStatusUpdateBody"
      responses:
        default:
          description: default response
          content:
            '*/*': {}
      security:
      - oauth2:
        - write:mireport
  /v1/workspaces/{workspaceId}/market-intelligence/{jobId}/step1:
    patch:
      tags:
      - market-intelligence
      summary: Persist STEP1 extraction result
      description: '**Requires a machine-to-machine token** (Auth0 `client_credentials`
        grant). Consumed by the market-intelligence worker; not intended for dashboard
        users.'
      operationId: updateStep1Result
      parameters:
      - name: jobId
        in: path
        required: true
        schema:
          type: string
          format: uuid
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/PipelineStep1ResultBody"
      responses:
        default:
          description: default response
          content:
            '*/*': {}
      security:
      - oauth2:
        - write:mireport
  /v1/workspaces/{workspaceId}/metrics:
    get:
      tags:
      - metrics
      summary: "Get data-sources, audiences and distribution channels metrics"
      operationId: getMetrics
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      responses:
        "200":
          description: The metrics descriptor
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/MetricsDTO"
      security:
      - oauth2:
        - read:workspaces
  /public/openapi:
    get:
      tags:
      - utils
      operationId: get
      responses:
        default:
          description: default response
          content:
            text/vnd.yaml: {}
  /public/swaggerui:
    get:
      tags:
      - utils
      operationId: getSwaggerUI
      responses:
        default:
          description: default response
          content:
            text/html: {}
  /v1/scopes:
    get:
      tags:
      - utils
      operationId: getScopes
      responses:
        default:
          description: default response
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/Scope"
      security:
      - oauth2:
        - read:scopes
  /v1/support:
    post:
      tags:
      - support
      summary: create a support request
      operationId: support
      requestBody:
        description: the support request payload required for the creation
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateSupportBody"
        required: true
      responses:
        default:
          description: default response
          content:
            '*/*': {}
  /v1/terms:
    get:
      tags:
      - support
      summary: Get current legal documents info (Terms & Privacy)
      operationId: getLatestTerms
      responses:
        "200":
          description: Current legal documents info
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/TermsAndConditionsResponse"
        "404":
          description: No legal documents available
    post:
      tags:
      - support
      summary: Create a new legal documents version (Terms & Privacy)
      description: "Creates a new version of the legal bundle, including Terms and\
        \ Conditions and the Privacy Policy. This endpoint requires M2M authentication."
      operationId: createTerms
      requestBody:
        description: Legal documents bundle (Terms & Privacy) with their URLs and
          per-document versions.
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateTermsDTO"
        required: true
      responses:
        "201":
          description: Created legal documents bundle (Terms & Privacy)
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/TermsAndConditionsResponse"
        "400":
          description: Bad Request - Invalid input
        "401":
          description: Unauthorized - M2M token required
        "500":
          description: Internal server error
      security:
      - oauth2:
        - admin:write:workspaces
  /v1/workspaces/{workspaceId}/traits:
    get:
      tags:
      - trait
      summary: retrieves the list of all traits
      operationId: getAll
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      responses:
        "200":
          description: the list of traits
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Traits"
      security:
      - oauth2:
        - read:trait
  /v1/workspaces/{workspaceId}/traits/customer:
    get:
      tags:
      - trait
      summary: retrieves the list of traits
      operationId: getAllCustomer
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      - name: onlyIdentifiers
        in: query
        schema:
          type: boolean
          default: false
      responses:
        "200":
          description: the list of traits
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/TraitsCollection"
      security:
      - oauth2:
        - read:trait
  /v1/workspaces/{workspaceId}/traits/event:
    get:
      tags:
      - trait
      summary: retrieves the list of event traits
      operationId: getAllEvent
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      responses:
        "200":
          description: the list of traits
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/TraitsCollection"
      security:
      - oauth2:
        - read:trait
  /v1/workspaces/{workspaceId}/unified-profile/count:
    get:
      tags:
      - unified-profile
      summary: profiles count
      operationId: countUnifiedProfiles
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      - name: search
        in: query
        required: true
        schema:
          type: string
      responses:
        "200":
          description: the number of unified-profiles matching the search query
          content:
            application/json:
              schema:
                type: integer
                format: int64
                example: 1234567890
        "400":
          description: missing search parameter
        "500":
          description: internal server error
      security:
      - oauth2:
        - read:unifiedprofile
  /v1/workspaces/{workspaceId}/unified-profile/{unifiedProfileEmail}:
    get:
      tags:
      - unified-profile
      summary: retrieves a specific unified-profile
      operationId: getUnifiedProfile
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      - name: unifiedProfileEmail
        in: path
        required: true
        schema:
          type: string
      responses:
        "200":
          description: the unified-profile details
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/UnifiedProfileDTO"
        "404":
          description: unified-profile not found
        "500":
          description: internal server error
      security:
      - oauth2:
        - read:unifiedprofile
  /v1/workspaces/{workspaceId}/unified-profile:
    get:
      tags:
      - unified-profile
      summary: lists unified-profiles
      operationId: listUnifiedProfiles
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      - name: limit
        in: query
        schema:
          type: integer
          format: int32
          default: 10
      - name: offset
        in: query
        schema:
          type: integer
          format: int32
          default: 0
      - name: search
        in: query
        required: true
        schema:
          type: string
      responses:
        "200":
          description: the list of unified-profiles
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/UnifiedProfileListItemDTO"
        "400":
          description: missing search parameter
        "500":
          description: internal server error
      security:
      - oauth2:
        - read:unifiedprofile
  /v1/companies/{companyId}/users/{userId}:
    put:
      tags:
      - users
      summary: assign the user to the current company
      operationId: assignUserToCompany
      parameters:
      - name: companyId
        in: path
        required: true
        schema:
          type: string
      - name: userId
        in: path
        required: true
        schema:
          type: string
      requestBody:
        description: the roles to be set
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UserRoleBody"
        required: true
      responses:
        "200":
          description: the assignment confirmation
      security:
      - oauth2:
        - write:users
    delete:
      tags:
      - users
      summary: remove a user from a company
      operationId: removeUser
      parameters:
      - name: companyId
        in: path
        required: true
        schema:
          type: string
      - name: userId
        in: path
        required: true
        schema:
          type: string
      responses:
        "200":
          description: the user removal confirmation
      security:
      - oauth2:
        - write:users
  /v1/companies/{companyId}/users/{userId}/role:
    patch:
      tags:
      - users
      summary: change the user role for the current company
      operationId: changeRole
      parameters:
      - name: companyId
        in: path
        required: true
        schema:
          type: string
      - name: userId
        in: path
        required: true
        schema:
          type: string
      requestBody:
        description: the roles to be set
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UserRoleBody"
        required: true
      responses:
        "200":
          description: the updated user info
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CompanyCDPUserDTO"
      security:
      - oauth2:
        - write:users
  /v1/companies/{companyId}/users:
    get:
      tags:
      - users
      summary: get a company users
      operationId: getCompanyUsers
      parameters:
      - name: companyId
        in: path
        required: true
        schema:
          type: string
      responses:
        "200":
          description: the list of users
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/CompanyCDPUserDTO"
      security:
      - oauth2:
        - read:company
  /v1/onboard/company:
    post:
      tags:
      - onboard
      summary: Onboard a new company
      description: |-
        Creates a new company with associated user, workspace and administrative data.

        The user specified in the request does not need to exist beforehand - if the user doesn't exist, they will be created; if they already exist in the system, they will be reused. The user will be assigned ADMIN role for both the newly created company and workspace.

        If enabled, the company domain is automatically extracted from the user's email address.

        The user will receive an email with instructions to set up their password and access the platform.

        **Authentication:** This endpoint requires a Machine-to-Machine (M2M) token for access.
      operationId: onboardCompany
      requestBody:
        description: Company onboarding data including company details and user information
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/OnboardCompanyBody"
        required: true
      responses:
        "200":
          description: Company successfully onboarded with user and workspace created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/OnboardCompanyResponse"
        "400":
          description: Bad request - missing or invalid parameters
        "401":
          description: Unauthorized - M2M token required
        "500":
          description: Internal server error - error during company onboarding process
      security:
      - oauth2:
        - admin:write:users
        - admin:write:workspaces
        - write:company
  /v1/onboard/workspace:
    post:
      tags:
      - onboard
      summary: Onboard a new workspace
      description: |-
        Creates a new workspace for the provided company and associates the list of users to it.

        All the users need to exist beforehand, the first one in the list will be assigned as the workspace admin.

        No email is sent to the users.

        **Authentication:** This endpoint requires a Machine-to-Machine (M2M) token for access.
      operationId: onboardWorkspace
      requestBody:
        description: Workspace onboarding data
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/OnboardWorkspaceBody"
        required: true
      responses:
        "200":
          description: Workspace successfully onboarded
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/OnboardWorkspaceResponse"
        "400":
          description: Bad request - missing or invalid parameters
        "401":
          description: Unauthorized - M2M token required
        "500":
          description: Internal server - error during workspace onboarding process
      security:
      - oauth2:
        - admin:write:users
        - admin:write:workspaces
  /v1/workspaces/{workspaceId}/roles:
    get:
      tags:
      - workspaces
      operationId: getWorkspaceRoles
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      responses:
        default:
          description: default response
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/PagingObjectWorkspaceRoleDTO"
      security:
      - oauth2:
        - read:roles
  /v1/userinfo:
    get:
      tags:
      - users
      summary: get user information
      description: |
        Get the user information, including the workspaces they belong to, their roles, and any pending workspace invites they have.
      operationId: getUserInfo
      responses:
        "200":
          description: the information
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/UserInfo"
  /v1/users/self/change-password:
    post:
      tags:
      - users
      summary: Request a password change email for the current user
      description: Initiates a password change process by sending an email with a
        secure password reset link to the authenticated user's registered email address.
        No request body is required as the user is identified from the authentication
        context.
      operationId: changePassword
      responses:
        "200":
          description: Password change email request processed successfully
          content:
            application/json:
              schema:
                type: object
                example:
                  result: true
              examples:
                Success response:
                  summary: Email sent successfully
                  description: Success response
                  value:
                    result: true
        "401":
          description: Unauthorized - user not authenticated
        "404":
          description: User not found
        "500":
          description: "Internal server error occurred while processing the password\
            \ change request (e.g., email service failure, Auth0 communication error)"
  /v1/users/self/change-password-ticket:
    post:
      tags:
      - users
      summary: Create a change-password ticket for the current user
      description: "Generates a secure, time-limited ticket that allows the authenticated\
        \ user to change their password. The ticket URL can be sent via email or other\
        \ communication channels."
      operationId: changePasswordTicket
      requestBody:
        description: Configuration for the password change ticket
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/ChangePasswordRequest"
            examples:
              Basic request:
                summary: Standard password change ticket request
                description: Basic request
                value:
                  callback: https://myapp.com/password-changed
                  ttlSeconds: 3600
        required: true
      responses:
        "200":
          description: Password change ticket created successfully
          content:
            application/json:
              schema:
                type: object
                example:
                  ticket: https://api.example.com/password-reset/abc123def456ghi789
              examples:
                Success response:
                  description: Success response
                  value:
                    ticket: https://api.example.com/password-reset/abc123def456ghi789
        "400":
          description: "Bad request - missing or invalid parameters (e.g., missing\
            \ callback parameter)"
        "401":
          description: Unauthorized - user not authenticated
        "404":
          description: User not found
        "500":
          description: Internal server error occurred while creating the ticket
  /v1/users/{userId}/change-password:
    post:
      tags:
      - users
      summary: Request a password change email for a specific user
      description: "Initiates a password change process for the specified user by\
        \ sending an email with a secure password reset link to their registered email\
        \ address. This endpoint requires WRITE_USERS scope and enforces authorization\
        \ rules: users can only reset passwords for other users within their shared\
        \ workspaces or company. Machine-to-machine (M2M) tokens bypass workspace/company\
        \ restrictions."
      operationId: changeUserPassword
      parameters:
      - name: userId
        in: path
        required: true
        schema:
          type: string
      responses:
        "200":
          description: Password change email request processed successfully
          content:
            application/json:
              schema:
                type: object
                example:
                  result: true
              examples:
                Success response:
                  summary: Email sent successfully
                  description: Success response
                  value:
                    result: true
        "401":
          description: Unauthorized - missing or invalid authentication
        "403":
          description: Forbidden - insufficient permissions (missing WRITE_USERS scope)
            or user authorization failed (current user cannot reset password for target
            user - no shared workspaces or company)
        "404":
          description: User not found - the specified userId does not exist
        "500":
          description: "Internal server error occurred while processing the password\
            \ change request (e.g., email service failure, Auth0 communication error,\
            \ database error)"
      security:
      - oauth2:
        - write:users
  /v1/users/{userId}:
    delete:
      tags:
      - users
      summary: user soft-deletion
      operationId: deleteUser
      parameters:
      - name: userId
        in: path
        required: true
        schema:
          type: string
      responses:
        "200":
          description: deletion confirmation
      security:
      - oauth2:
        - write:users
    patch:
      tags:
      - users
      summary: update user's personal info
      operationId: updateUser
      parameters:
      - name: userId
        in: path
        required: true
        schema:
          type: string
      requestBody:
        description: the information to be updated
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UpdateUserInfoBody"
      responses:
        "200":
          description: the updated user
          content:
            application/json: {}
      security:
      - oauth2:
        - write:users
  /v1/users/self/password-policy:
    get:
      tags:
      - users
      summary: return password policies for the provided user
      operationId: passwordPolicy
      responses:
        "200":
          description: the password policies
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/PasswordPolicyDTO"
  /v1/users/password-recovery:
    post:
      tags:
      - users
      summary: Request a password recovery email for a specific user
      description: Initiates a password change process for the specified user by sending
        an email with a secure password reset link to their registered email address.
        This is a public endpoint that does not require authentication (no bearer
        token needed).
      operationId: passwordRecovery
      requestBody:
        description: The user email address
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/PasswordRecoveryRequest"
      responses:
        "200":
          description: Password recovery request processed successfully. An email
            will be sent if the email address exists in the system.
        "429":
          description: "Too many requests: the maximum number of password recovery\
            \ requests has been exceeded."
  /v1/users/self:
    patch:
      tags:
      - users
      summary: update user information
      operationId: patchUserInfo
      requestBody:
        description: the information to be updated
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UpdateUserInfoBody"
      responses:
        "200":
          description: the updated information
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CDPUserDTO"
  /v1/workspaces/{workspaceId}/users:
    get:
      tags:
      - users
      summary: get the workspace users
      operationId: getUsers
      parameters:
      - name: limit
        in: query
        schema:
          type: string
        example: 50
      - name: offset
        in: query
        schema:
          type: string
        example: 0
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      - name: q
        in: query
        schema:
          type: string
      responses:
        "200":
          description: the list of users
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/PaginatedWorkspaceUsers"
      security:
      - oauth2:
        - read:users
    post:
      tags:
      - users
      summary: creates a user under workspace
      operationId: addWorkspaceUser
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      requestBody:
        description: the user payload required for the creation
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateUserBody"
        required: true
      responses:
        "200":
          description: the created user
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/WorkspaceUser"
      security:
      - oauth2:
        - write:users
  /v1/workspaces/{workspaceId}/users/{userId}/role:
    patch:
      tags:
      - users
      summary: change the user role for the current workspace
      operationId: changeUserRole
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      - name: userId
        in: path
        required: true
        schema:
          type: string
      requestBody:
        description: the role to be set
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/ChangeRoleBody"
        required: true
      responses:
        "200":
          description: the updated user info
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/WorkspaceUserDTO"
      security:
      - oauth2:
        - write:users
  /v1/workspaces/{workspaceId}/users/count:
    get:
      tags:
      - users
      summary: "Counts the users for a workspace, optionally filtered by query"
      operationId: countWorkspaceUsers
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      - name: q
        in: query
        description: |-
          Optional filter. If provided, must be at least 3 characters long.
          Matches users by:
          - first name
          - last name
          - email
          - externalId
          - userId
        schema:
          type: string
      responses:
        "200":
          description: number of users
          content:
            application/json:
              schema:
                type: integer
                format: int64
        "400":
          description: "Bad request: q cannot be less than 3 chars"
        "404":
          description: Workspace not found
      security:
      - oauth2:
        - read:users
  /v1/workspaces/{workspaceId}/users/{userId}:
    delete:
      tags:
      - users
      summary: remove a user from a workspace
      description: |-
        Removes the specified user from the workspace and revokes their workspace role.

        This endpoint is restricted to machine-to-machine (M2M) clients only.
      operationId: removeUser_1
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      - name: userId
        in: path
        required: true
        schema:
          type: string
      responses:
        "200":
          description: the user removal confirmation
        "401":
          description: caller is not a machine-to-machine client
        "400":
          description: invalid request
        "404":
          description: workspace or user not found
      security:
      - oauth2:
        - write:users
  /v1/workspace/{workspaceId}/userjourney/mail/templates:
    get:
      tags:
      - user-journey-mail
      summary: List email templates
      description: Returns email templates for the workspace's mail connector
      operationId: listTemplates
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      responses:
        "200":
          description: List of email templates
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/MailTemplateDTO"
        "404":
          description: Mail connector not found or not configured
      security:
      - oauth2:
        - read:channels
  /v1/workspace/{workspaceId}/userjourney/whatsapp/templates:
    get:
      tags:
      - user-journey-whatsapp
      summary: List WhatsApp message templates
      description: Returns message templates grouped by WhatsApp Business Account
        for the workspace's WhatsApp connector
      operationId: listTemplates_1
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      responses:
        "200":
          description: List of templates grouped by business account
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/WhatsappBusinessAccountTemplatesDTO"
        "404":
          description: WhatsApp connector not found or not configured
      security:
      - oauth2:
        - read:channels
  /v1/public/webhook/mailtrap:
    post:
      tags:
      - mailtrap-webhook
      summary: Mailtrap webhook callback
      description: "Receives email events from Mailtrap (delivery, open, click, bounce,\
        \ soft bounce, spam, unsubscribe, suspension, reject). Validates the Mailtrap-Signature\
        \ header using HMAC-SHA256 over the raw body."
      operationId: receive
      parameters:
      - name: Mailtrap-Signature
        in: header
        schema:
          type: string
      requestBody:
        content:
          application/json:
            schema:
              type: string
      responses:
        "200":
          description: Webhook processed
        "401":
          description: Invalid signature
  /v1/public/webhook/whatsapp:
    get:
      tags:
      - whatsapp-webhook
      summary: WhatsApp webhook verification
      description: Meta sends a GET request to verify the webhook URL. Responds with
        the challenge if the verify token matches.
      operationId: verify
      parameters:
      - name: hub.mode
        in: query
        schema:
          type: string
      - name: hub.verify_token
        in: query
        schema:
          type: string
      - name: hub.challenge
        in: query
        schema:
          type: string
      responses:
        "200":
          description: Verification successful
        "403":
          description: Verification failed
    post:
      tags:
      - whatsapp-webhook
      summary: WhatsApp webhook callback
      description: "Receives status updates from WhatsApp (sent, delivered, read,\
        \ failed). Validates the X-Hub-Signature-256 header using HMAC-SHA256."
      operationId: receive_1
      parameters:
      - name: X-Hub-Signature-256
        in: header
        schema:
          type: string
      requestBody:
        content:
          application/json:
            schema:
              type: string
      responses:
        "200":
          description: Webhook processed
        "401":
          description: Invalid signature
  /v1/workspaces/{workspaceId}/ingestion:
    patch:
      tags:
      - workspaces
      summary: updates ingestion information for a workspace
      operationId: updateWorkspace
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/WorkspaceIngestionBody"
      responses:
        "200":
          description: the updated workspace
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/SimpleWorkspaceDTO"
      security:
      - oauth2:
        - admin:write:workspaces
  /v1/workspaces/accept-invite/{inviteId}:
    post:
      tags:
      - workspaces
      summary: accepts a pending workspace-invite for the current user and assign
        the user to the related company when applicable
      operationId: acceptWorkspaceInvite
      parameters:
      - name: inviteId
        in: path
        required: true
        schema:
          type: string
      responses:
        "200":
          description: the accepted-invite confirmation
  /v1/workspaces/{workspaceId}/invite/count:
    get:
      tags:
      - workspaces
      summary: Counts workspace invites with status PENDING or EXPIRED
      operationId: countWorkspaceInvites
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      responses:
        "200":
          description: number of invites
          content:
            application/json:
              schema:
                type: integer
                format: int64
        "404":
          description: Workspace not found
      security:
      - oauth2:
        - read:workspacesinvite
  /v1/workspaces/{workspaceId}/invite:
    post:
      tags:
      - workspaces
      summary: creates a workspace-invite for the supplied user
      description: |-
        Creates a pending invite for the given email address in the specified workspace.
        Supports both user and M2M (machine-to-machine) authentication.

        The invite is rejected if the workspace user limit (active users + pending invites) would be exceeded or if an invite for the same email is already pending. When using M2M authentication, the user limit check is bypassed.
      operationId: createWorkspaceInvite
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      requestBody:
        description: the email address of the user to invite
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/WorkspaceInviteRequest"
        required: true
      responses:
        "200":
          description: the invite info
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/WorkspaceInviteDTO"
        "400":
          description: invalid request
        "404":
          description: workspace or user not found
        "409":
          description: workspace user limit exceeded or invite already exists
      security:
      - oauth2:
        - write:workspacesinvite
  /v1/workspaces/{workspaceId}/delete-invite/{inviteId}:
    delete:
      tags:
      - workspaces
      summary: deletes a workspace-invite
      operationId: deleteInvite_1
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      - name: inviteId
        in: path
        required: true
        schema:
          type: string
      responses:
        "200":
          description: the invite removal confirmation
      security:
      - oauth2:
        - write:workspacesinvite
  /v1/workspaces/{workspaceId}/list-invite:
    get:
      tags:
      - workspaces
      summary: returns the invites for the provided workspace
      operationId: getWorkspaceInvites
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      responses:
        "200":
          description: the invite list
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/PaginatedWorkspaceInvite"
      security:
      - oauth2:
        - read:workspacesinvite
  /v1/workspaces/{workspaceId}/send-invite-email/{inviteId}:
    get:
      tags:
      - workspaces
      summary: "send a workspace-invitation email. Typically an email is automatically\
        \ sent at the end of the invitation process, this endpoint should be used\
        \ only to trigger an additional dispatch in case the first message got lost."
      operationId: sendEmail_1
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      - name: inviteId
        in: path
        required: true
        schema:
          type: string
      responses:
        "200":
          description: the dispatch confirmation
      security:
      - oauth2:
        - read:workspacesinvite
  /v1/workspaces/{workspaceId}/resources:
    get:
      tags:
      - workspaces
      summary: Get workspace resources
      description: "Retrieves all workspace resources including datasources, audiences,\
        \ and connectors. Optionally filters resources based on a query."
      operationId: getResources
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      - name: q
        in: query
        schema:
          type: string
      responses:
        "200":
          description: Successful retrieval of workspace resources
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/WorkspaceResourcesDTO"
        "404":
          description: Workspace not found
        "400":
          description: Invalid request parameters
        "500":
          description: Internal server error
      security:
      - oauth2:
        - read:workspaces
  /v1/workspaces/{workspaceId}/resources/detailed:
    get:
      tags:
      - workspaces
      summary: Get detailed workspace resources
      description: "Retrieves detailed resources for a workspace, including datasources,\
        \ audiences, and connectors."
      operationId: getResourcesDetails
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      responses:
        "200":
          description: Successful retrieval of workspace resources
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/WorkspaceDetailedResourcesDTO"
        "404":
          description: Workspace not found
        "500":
          description: Internal server error
      security:
      - oauth2:
        - read:workspaces
  /v1/workspaces:
    get:
      tags:
      - workspaces
      summary: retrieves a list of user's workspaces
      operationId: getWorkspaces
      parameters:
      - name: limit
        in: query
        schema:
          type: integer
          format: int32
          default: 50
      - name: offset
        in: query
        schema:
          type: integer
          format: int32
          default: 0
      responses:
        "200":
          description: the list of the workspaces
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/PagedWorkspaces"
      security:
      - oauth2:
        - read:workspaces
    post:
      tags:
      - workspaces
      summary: create a workspace
      operationId: createWorkspace
      requestBody:
        description: the workspace info
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateUpdateWorkspaceBody"
        required: true
      responses:
        "200":
          description: the newly created workspace
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/WorkspaceDTO"
      security:
      - oauth2:
        - write:workspaces
  /v1/workspaces/{workspaceId}/encryption/key-pair:
    post:
      tags:
      - workspaces
      summary: create workspace encryption key pair
      operationId: createWorkspaceEncryptionKey
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      responses:
        "200":
          description: the public key
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/WorkspaceEncryptionPublicKeyDTO"
      security:
      - oauth2:
        - read:workspaces
  /v1/workspaces/{workspaceId}:
    get:
      tags:
      - workspaces
      summary: get a single workspace
      operationId: getWorkspace
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      responses:
        "200":
          description: the workspace requested
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/WorkspaceDTO"
      security:
      - oauth2:
        - read:workspaces
    delete:
      tags:
      - workspaces
      summary: deletes a workspace
      description: |
        Deletes a workspace by its external ID. M2M clients can delete any workspace.
        For user requests, the caller must have access to the workspace.
      operationId: deleteWorkspace
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      responses:
        "200":
          description: workspace successfully deleted
        "403":
          description: user does not have access to the workspace
        "404":
          description: workspace not found
        "500":
          description: unable to fetch user workspaces
      security:
      - oauth2:
        - write:workspaces
    patch:
      tags:
      - workspaces
      summary: updates a single workspace
      operationId: updateWorkspace_1
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateUpdateWorkspaceBody"
      responses:
        "200":
          description: the updated workspace
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/WorkspaceDTO"
      security:
      - oauth2:
        - write:workspaces
  /v1/workspaces/{workspaceId}/usage/summary:
    get:
      tags:
      - workspaces
      summary: get workspaces usage summary
      operationId: getUsageSummary
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      responses:
        "200":
          description: the usage summary
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/WorkspaceUsageSummaryDTO"
      security:
      - oauth2:
        - read:billing
  /v1/workspaces/{workspaceId}/encryption/public-key:
    get:
      tags:
      - workspaces
      summary: get workspace encryption public key
      operationId: getWorkspaceEncryptionPublicKey
      parameters:
      - name: workspaceId
        in: path
        required: true
        schema:
          type: string
      responses:
        "200":
          description: the public key
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/WorkspaceEncryptionPublicKeyDTO"
      security:
      - oauth2:
        - read:workspaces
components:
  schemas:
    AudienceDTO:
      type: object
      properties:
        name:
          type: string
        expression:
          $ref: "#/components/schemas/JsonNode"
        matchingTrait:
          type: string
        evalConfiguration:
          $ref: "#/components/schemas/JsonNode"
        scheduleType:
          type: string
          enum:
          - REALTIME
          - SCHEDULED
          - MANUAL
        scheduleConfiguration:
          $ref: "#/components/schemas/JsonNode"
        realtime:
          type: boolean
        createdOn:
          type: string
          format: date-time
        deletedOn:
          type: string
          format: date-time
        id:
          type: string
        datasourceIds:
          type: array
          items:
            type: string
    JsonNode:
      type: object
    CreateAudienceBody:
      type: object
      properties:
        name:
          type: string
        matchingTrait:
          type: string
        datasourceIds:
          type: array
          items:
            type: string
    AudienceLightDTO:
      type: object
      properties:
        name:
          type: string
        createdOn:
          type: string
          format: date-time
        scheduleType:
          type: string
          enum:
          - REALTIME
          - SCHEDULED
          - MANUAL
        deletedOn:
          type: string
          format: date-time
        id:
          type: string
    PaginatedAllAudience:
      type: object
      properties:
        audiences:
          $ref: "#/components/schemas/PagingObjectAudienceLightDTO"
    PagingObjectAudienceLightDTO:
      type: object
      properties:
        items:
          type: array
          items:
            $ref: "#/components/schemas/AudienceLightDTO"
        limit:
          type: integer
          format: int32
        offset:
          type: integer
          format: int32
    AudienceDependencies:
      type: object
      properties:
        audiences:
          type: array
          items:
            $ref: "#/components/schemas/AudienceLightDTO"
        campaigns:
          type: array
          items:
            $ref: "#/components/schemas/CampaignLightDTO"
    CampaignLightDTO:
      type: object
      properties:
        name:
          type: string
        createdOn:
          type: string
          format: date-time
        id:
          type: string
    AudienceEstimate:
      type: object
      properties:
        audienceId:
          type: string
        size:
          type: integer
          format: int64
    ActionRule:
      type: object
      allOf:
      - $ref: "#/components/schemas/AudienceRule"
      - type: object
        properties:
          kind:
            type: string
          dataSourceRuleId:
            type: string
          customEventName:
            type: string
          dataSourceId:
            type: string
          occurrences:
            $ref: "#/components/schemas/Occurrences"
          temporalHorizon:
            $ref: "#/components/schemas/TemporalHorizon"
    AudienceEstimateBody:
      type: object
      properties:
        expression:
          type: object
          additionalProperties:
            type: object
            additionalProperties:
              $ref: "#/components/schemas/AudienceRule"
    AudienceRule:
      type: object
      properties:
        type:
          type: string
          enum:
          - ACTION
          - PROPERTY
          - MEMBERSHIP
      discriminator:
        propertyName: type
      oneOf:
      - $ref: "#/components/schemas/ActionRule"
      - $ref: "#/components/schemas/PropertyRule"
      - $ref: "#/components/schemas/MembershipRule"
    Between:
      type: object
      allOf:
      - $ref: "#/components/schemas/TemporalHorizon"
      - type: object
        properties:
          from:
            type: string
            format: date
          to:
            type: string
            format: date
    MembershipRule:
      type: object
      allOf:
      - $ref: "#/components/schemas/AudienceRule"
      - type: object
        properties:
          membership:
            type: string
            enum:
            - IN
            - NOT_IN
          audienceIds:
            type: array
            items:
              type: string
    Occurrences:
      type: object
      properties:
        comparisonOp:
          type: string
          enum:
          - AT_LEAST
          - EXACTLY
          - AT_MOST
          - NEVER
        times:
          type: integer
          format: int32
    PropertyRule:
      type: object
      allOf:
      - $ref: "#/components/schemas/AudienceRule"
      - type: object
        properties:
          property:
            type: string
          trait:
            type: boolean
          comparisonOp:
            type: string
            enum:
            - EQUALS
            - NOT_EQUALS
            - CONTAINS
            - "NULL"
            - NOT_NULL
            - GT
            - GTE
            - LT
            - LTE
          value:
            type: string
          dataType:
            type: string
            enum:
            - TEXT
            - NUMBER
            - DATE
            - DATETIME
          aggregationType:
            type: string
            enum:
            - NONE
            - SUM
            - MAX
            - MIN
            - AVG
            - COUNT
    TemporalHorizon:
      type: object
      properties:
        type:
          type: string
          enum:
          - WITHIN
          - BETWEEN
      discriminator:
        propertyName: type
      oneOf:
      - $ref: "#/components/schemas/Within"
      - $ref: "#/components/schemas/Between"
    Within:
      type: object
      allOf:
      - $ref: "#/components/schemas/TemporalHorizon"
      - type: object
        properties:
          value:
            type: integer
            format: int32
          unit:
            type: string
            enum:
            - DAY
            - WEEK
            - MONTH
            - YEAR
    PaginatedAudience:
      type: object
      properties:
        items:
          type: array
          items:
            $ref: "#/components/schemas/AudienceDTO"
        limit:
          type: integer
          format: int32
        offset:
          type: integer
          format: int32
    PagingObjectAudienceDTO:
      type: object
      properties:
        items:
          type: array
          items:
            $ref: "#/components/schemas/AudienceDTO"
        limit:
          type: integer
          format: int32
        offset:
          type: integer
          format: int32
    AudienceNextSchedule:
      type: object
      properties:
        nextSchedule:
          type: string
          format: date-time
    AudienceNextSchedules:
      type: object
      properties:
        nextSchedules:
          type: array
          items:
            type: string
            format: date-time
    AudienceScheduleConfiguration:
      type: object
      properties:
        type:
          type: string
          enum:
          - REALTIME
          - SCHEDULED
          - MANUAL
      anyOf:
      - $ref: "#/components/schemas/TimeBasedScheduleConfiguration"
      - $ref: "#/components/schemas/ManualScheduleConfiguration"
      - $ref: "#/components/schemas/RealTimeScheduleConfiguration"
    AudienceScheduleEvaluationBody:
      type: object
      properties:
        startsOn:
          type: string
          format: date-time
        times:
          type: integer
          format: int32
        scheduleType:
          type: string
          enum:
          - REALTIME
          - SCHEDULED
          - MANUAL
        scheduleConfiguration:
          $ref: "#/components/schemas/AudienceScheduleConfiguration"
    ManualScheduleConfiguration:
      type: object
      properties:
        emailNotification:
          type: boolean
        createSnapshotOnRefresh:
          type: boolean
        type:
          type: string
          enum:
          - REALTIME
          - SCHEDULED
          - MANUAL
    RealTimeScheduleConfiguration:
      type: object
      properties:
        type:
          type: string
          enum:
          - REALTIME
          - SCHEDULED
          - MANUAL
    TimeBasedScheduleConfiguration:
      type: object
      properties:
        emailNotification:
          type: boolean
        createSnapshotOnRefresh:
          type: boolean
        startsOn:
          type: string
          format: date-time
        repeatsEvery:
          type: integer
          format: int32
        unit:
          type: string
          enum:
          - Nanos
          - Micros
          - Millis
          - Seconds
          - Minutes
          - Hours
          - HalfDays
          - Days
          - Weeks
          - Months
          - Years
          - Decades
          - Centuries
          - Millennia
          - Eras
          - Forever
        weekDays:
          type: array
          items:
            type: string
            enum:
            - MONDAY
            - TUESDAY
            - WEDNESDAY
            - THURSDAY
            - FRIDAY
            - SATURDAY
            - SUNDAY
        dayOfMonth:
          type: integer
          format: int32
        type:
          type: string
          enum:
          - REALTIME
          - SCHEDULED
          - MANUAL
    PropertyOperationsDTO:
      type: object
      properties:
        propertyOperations:
          type: object
          additionalProperties:
            $ref: "#/components/schemas/TypeOperations"
          description: Map of property data types to their available operations
      description: Available operations for each property data type
      example:
        propertyOperations:
          DATE:
            operations:
            - EQUALS
            - GTE
            - GT
            - LT
            - LTE
          DATETIME:
            operations:
            - EQUALS
            - GTE
            - GT
            - LT
            - LTE
          NUMBER:
            aggregations:
            - NONE
            - SUM
            - MAX
            - MIN
            - AVG
            - COUNT
            operations:
            - EQUALS
            - GTE
            - GT
            - LT
            - LTE
          TEXT:
            operations:
            - EQUALS
            - NOT_EQUALS
            - CONTAINS
            - "NULL"
            - NOT_NULL
    TypeOperations:
      type: object
      properties:
        operations:
          uniqueItems: true
          type: array
          items:
            type: string
            enum:
            - EQUALS
            - NOT_EQUALS
            - CONTAINS
            - "NULL"
            - NOT_NULL
            - GT
            - GTE
            - LT
            - LTE
        aggregations:
          uniqueItems: true
          type: array
          description: Available aggregation types (only present for certain data
            types)
          nullable: true
          example:
          - SUM
          - AVG
          - COUNT
          items:
            type: string
            description: Available aggregation types (only present for certain data
              types)
            nullable: true
            example: "[\"SUM\",\"AVG\",\"COUNT\"]"
            enum:
            - NONE
            - SUM
            - MAX
            - MIN
            - AVG
            - COUNT
      description: Map of property data types to their available operations
    AudienceTraitDistributions:
      type: object
      properties:
        distributions:
          type: array
          items:
            $ref: "#/components/schemas/EventTraitDistribution"
    EventTraitDistribution:
      type: object
      properties:
        trait:
          $ref: "#/components/schemas/TraitDTO"
        count:
          type: integer
          format: int64
        total:
          type: integer
          format: int64
    TraitDTO:
      type: object
      properties:
        id:
          type: string
        displayName:
          type: string
        dotName:
          type: string
        identifier:
          type: boolean
        dataType:
          type: string
        type:
          type: string
    AudienceExpression:
      type: object
      properties:
        empty:
          type: boolean
      additionalProperties:
        type: object
        additionalProperties:
          $ref: "#/components/schemas/AudienceRule"
    AudienceScheduleBody:
      type: object
      properties:
        unit:
          type: string
          enum:
          - Nanos
          - Micros
          - Millis
          - Seconds
          - Minutes
          - Hours
          - HalfDays
          - Days
          - Weeks
          - Months
          - Years
          - Decades
          - Centuries
          - Millennia
          - Eras
          - Forever
        value:
          type: integer
          format: int32
    UpdateAudienceBody:
      type: object
      properties:
        name:
          type: string
        realtime:
          type: boolean
        schedule:
          $ref: "#/components/schemas/AudienceScheduleBody"
        scheduleType:
          type: string
          enum:
          - REALTIME
          - SCHEDULED
          - MANUAL
        scheduleConfiguration:
          $ref: "#/components/schemas/AudienceScheduleConfiguration"
        expression:
          type: object
          properties:
            empty:
              type: boolean
          additionalProperties:
            type: object
            additionalProperties:
              $ref: "#/components/schemas/AudienceRule"
    ExtractionStatusDTO:
      type: object
      properties:
        status:
          type: string
    AudienceConfigurationDTO:
      type: object
      properties:
        isRealtime:
          type: boolean
        matchingTraitId:
          type: string
        configuration:
          $ref: "#/components/schemas/JsonNode"
        id:
          type: string
    AudienceEvaluationHistoryDTO:
      type: object
      properties:
        audienceId:
          type: string
        scheduleType:
          type: string
          enum:
          - REALTIME
          - SCHEDULED
          - MANUAL
        status:
          type: string
          enum:
          - SUCCESS
          - ERROR
        payload:
          $ref: "#/components/schemas/JsonNode"
        evaluatedOn:
          type: string
          format: date-time
    AddRefreshHistoryBody:
      type: object
      properties:
        status:
          type: string
          enum:
          - SUCCESS
          - ERROR
        payload:
          $ref: "#/components/schemas/JsonNode"
        evaluatedOn:
          type: string
          format: date-time
    PagingObjectAudienceEvaluationHistoryDTO:
      type: object
      properties:
        items:
          type: array
          items:
            $ref: "#/components/schemas/AudienceEvaluationHistoryDTO"
        limit:
          type: integer
          format: int32
        offset:
          type: integer
          format: int32
    CampaignDTO:
      type: object
      properties:
        id:
          type: string
        name:
          type: string
        description:
          type: string
        datasourceTypes:
          type: array
          items:
            type: string
        destinationTypes:
          type: array
          items:
            type: string
        status:
          type: string
          enum:
          - ACTIVE
          - DRAFT
          - DELETED
        audienceId:
          type: string
        workspaceId:
          type: string
        createdOn:
          type: string
          format: date-time
    CreateCampaignBody:
      type: object
      properties:
        id:
          type: string
          description: Campaign id
        name:
          type: string
          description: Campaign name
        description:
          type: string
          description: Campaign description
        status:
          type: string
          description: "Campaign status, if ACTIVE properties audienceId, datasourceTypes\
            \ and destinationTypes are required"
          enum:
          - ACTIVE
          - DRAFT
          - DELETED
          - ACTIVE
          - DRAFT
          default: ACTIVE
        audienceId:
          type: string
          description: Audience ID associated with the campaign
        datasourceTypes:
          type: array
          description: List of datasource types
          items:
            type: string
            description: List of datasource types
        destinationTypes:
          type: array
          description: List of destination types
          items:
            type: string
            description: List of destination types
      description: Payload for creating a campaign
    PagingObjectCampaignDTO:
      type: object
      properties:
        items:
          type: array
          items:
            $ref: "#/components/schemas/CampaignDTO"
        limit:
          type: integer
          format: int32
        offset:
          type: integer
          format: int32
    UpdateCampaignBody:
      required:
      - description
      - name
      type: object
      properties:
        name:
          type: string
          description: Name of the campaign
        description:
          type: string
          description: Description of the campaign
      description: Payload for updating a campaign
    CampaignStatsDTO:
      type: object
      properties:
        totalSent:
          type: integer
          format: int32
        totalDelivered:
          type: integer
          format: int32
        totalRead:
          type: integer
          format: int32
        totalFailed:
          type: integer
          format: int32
        totalBounced:
          type: integer
          format: int32
        totalClicked:
          type: integer
          format: int32
        totalUnsubscribed:
          type: integer
          format: int32
        lastUpdatedAt:
          type: string
          format: date-time
    CampaignV2DTO:
      type: object
      properties:
        id:
          type: string
        name:
          type: string
        description:
          type: string
        audienceId:
          type: string
        workspaceId:
          type: string
        providerType:
          type: string
        connectorInstanceId:
          type: string
        connectorFlowInstanceId:
          type: string
        providerConfig:
          $ref: "#/components/schemas/JsonNode"
        status:
          type: string
          enum:
          - DRAFT
          - SCHEDULED
          - ACTIVE
          - PAUSED
          - COMPLETED
          - DELETED
        scheduledStart:
          type: string
          format: date-time
        scheduledEnd:
          type: string
          format: date-time
        createdOn:
          type: string
          format: date-time
        updatedOn:
          type: string
          format: date-time
        stats:
          $ref: "#/components/schemas/CampaignStatsDTO"
    CreateCampaignV2Body:
      required:
      - providerType
      type: object
      properties:
        name:
          type: string
          description: Campaign name
        description:
          type: string
          description: Campaign description
        status:
          type: string
          description: Campaign status
          enum:
          - DRAFT
          - SCHEDULED
          - ACTIVE
          - PAUSED
          - COMPLETED
          - DELETED
          - ACTIVE
          - DRAFT
          - SCHEDULED
          default: DRAFT
        audienceId:
          type: string
          description: Audience ID associated with the campaign
        providerType:
          type: string
          description: "Provider type (WHATSAPP, SMS, EMAIL, etc.)"
        connectorInstanceId:
          type: string
          description: Connector instance ID for provider authentication
        providerConfig:
          $ref: "#/components/schemas/JsonNode"
        scheduledStart:
          type: string
          description: Scheduled start time
          format: date-time
        scheduledEnd:
          type: string
          description: Scheduled end time
          format: date-time
      description: Payload for creating a campaign v2
    ProviderAggregatedStatsDTO:
      type: object
      properties:
        providerType:
          type: string
        totalCampaigns:
          type: integer
          format: int64
        totalSent:
          type: integer
          format: int64
        totalDelivered:
          type: integer
          format: int64
        totalRead:
          type: integer
          format: int64
        totalFailed:
          type: integer
          format: int64
        totalBounced:
          type: integer
          format: int64
        totalClicked:
          type: integer
          format: int64
        totalUnsubscribed:
          type: integer
          format: int64
    PagingObjectCampaignV2DTO:
      type: object
      properties:
        items:
          type: array
          items:
            $ref: "#/components/schemas/CampaignV2DTO"
        limit:
          type: integer
          format: int32
        offset:
          type: integer
          format: int32
    UpdateCampaignV2Body:
      type: object
      properties:
        name:
          type: string
          description: Campaign name
        description:
          type: string
          description: Campaign description
        status:
          type: string
          description: Campaign status
          enum:
          - DRAFT
          - SCHEDULED
          - ACTIVE
          - PAUSED
          - COMPLETED
          - DELETED
        audienceId:
          type: string
          description: Audience ID
        connectorInstanceId:
          type: string
          description: Connector instance ID
        connectorFlowInstanceId:
          type: string
          description: Connector flow instance ID - links campaign to send flow. Required
            for ACTIVE status
        providerConfig:
          $ref: "#/components/schemas/JsonNode"
        scheduledStart:
          type: string
          description: Scheduled start time
          format: date-time
        scheduledEnd:
          type: string
          description: Scheduled end time
          format: date-time
      description: Payload for updating a campaign v2
    CardContainerDTO:
      type: object
      properties:
        name:
          type: string
        configuration:
          $ref: "#/components/schemas/JsonNode"
        resourceId:
          type: string
        cards:
          uniqueItems: true
          type: array
          items:
            type: string
        createdOn:
          type: string
          format: date-time
        createdBy:
          type: string
        updatedOn:
          type: string
          format: date-time
        updatedBy:
          type: string
        id:
          type: string
        workspaceId:
          type: string
    CreateCardContainerRequest:
      required:
      - configuration
      - name
      - resourceId
      type: object
      properties:
        name:
          type: string
        resourceId:
          type: string
          description: Id of the resource the container belongs to
        configuration:
          $ref: "#/components/schemas/JsonNode"
    CreateCardRequest:
      required:
      - configuration
      - name
      - operationId
      - resourceId
      type: object
      properties:
        name:
          type: string
        type:
          type: string
          enum:
          - NUMERIC
          default: NUMERIC
        refreshPeriodMinutes:
          type: integer
          format: int32
          default: 60
        configuration:
          $ref: "#/components/schemas/JsonNode"
        maxWindowMinutes:
          type: integer
          format: int32
          nullable: true
        resourceId:
          type: string
          description: Id of the resource the card belongs to
        operationId:
          type: string
        cardContainerId:
          type: string
          nullable: true
    PaginatedCardContainer:
      type: object
      properties:
        items:
          type: array
          items:
            $ref: "#/components/schemas/CardContainerDTO"
        limit:
          type: integer
          format: int32
        offset:
          type: integer
          format: int32
    PagingObjectCardContainerDTO:
      type: object
      properties:
        items:
          type: array
          items:
            $ref: "#/components/schemas/CardContainerDTO"
        limit:
          type: integer
          format: int32
        offset:
          type: integer
          format: int32
    CardDTO:
      type: object
      properties:
        name:
          type: string
        type:
          type: string
          enum:
          - NUMERIC
        refreshPeriodMinutes:
          type: integer
          format: int32
        configuration:
          $ref: "#/components/schemas/JsonNode"
        maxWindowMinutes:
          type: integer
          format: int32
        resourceId:
          type: string
        createdOn:
          type: string
          format: date-time
        createdBy:
          type: string
        updatedOn:
          type: string
          format: date-time
        updatedBy:
          type: string
        id:
          type: string
        workspaceId:
          type: string
        operationId:
          type: string
    PaginatedCard:
      type: object
      properties:
        items:
          type: array
          items:
            $ref: "#/components/schemas/CardDTO"
        limit:
          type: integer
          format: int32
        offset:
          type: integer
          format: int32
    PagingObjectCardDTO:
      type: object
      properties:
        items:
          type: array
          items:
            $ref: "#/components/schemas/CardDTO"
        limit:
          type: integer
          format: int32
        offset:
          type: integer
          format: int32
    CardOperationAdminDTO:
      type: object
      properties:
        name:
          type: string
        type:
          type: string
          enum:
          - QUERY
        resourceType:
          type: string
          enum:
          - AUDIENCE
          - DATASOURCE
          - WORKSPACE
        sourceType:
          type: string
          enum:
          - S3
          - ROCKSET
          - DYNAMO_DB
        queryTemplate:
          type: string
        createdOn:
          type: string
          format: date-time
        id:
          type: string
    CreateCardOperationBody:
      type: object
      properties:
        name:
          type: string
        type:
          type: string
          enum:
          - QUERY
          default: QUERY
        resourceType:
          type: string
          enum:
          - AUDIENCE
          - DATASOURCE
          - WORKSPACE
        sourceType:
          type: string
          enum:
          - S3
          - ROCKSET
          - DYNAMO_DB
        queryTemplate:
          type: string
    CardOperationDTO:
      type: object
      properties:
        name:
          type: string
        type:
          type: string
          enum:
          - QUERY
        resourceType:
          type: string
          enum:
          - AUDIENCE
          - DATASOURCE
          - WORKSPACE
        createdOn:
          type: string
          format: date-time
        id:
          type: string
    UpdateCardOperationBody:
      type: object
      properties:
        name:
          type: string
        sourceType:
          type: string
          enum:
          - S3
          - ROCKSET
          - DYNAMO_DB
        queryTemplate:
          type: string
    CompanyDTO:
      type: object
      properties:
        name:
          type: string
        domains:
          type: array
          items:
            type: string
        id:
          type: string
        created_on:
          type: string
          format: date-time
        updated_on:
          type: string
          format: date-time
    CreateCompanyBody:
      type: object
      properties:
        userExternalId:
          type: string
        name:
          type: string
        domains:
          type: array
          items:
            type: string
    CompanyAdministrativeDataDTO:
      type: object
      properties:
        legalEntity:
          type: string
        licenseNumber:
          type: string
        email:
          type: string
        vatNumber:
          type: string
        legalAddress1:
          type: string
        legalAddress2:
          type: string
        city:
          type: string
        state:
          type: string
        zip:
          type: string
        country:
          type: string
        createdOn:
          type: string
          format: date-time
        updatedOn:
          type: string
          format: date-time
    WorkspaceDTO:
      type: object
      properties:
        slug:
          type: string
        name:
          type: string
        createdOn:
          type: string
          format: date-time
        description:
          type: string
        billingEmail:
          type: string
        dataAccount:
          type: string
        dataRegion:
          type: string
        ingestionUrl:
          type: string
        companyId:
          type: string
        companyName:
          type: string
        userCount:
          type: integer
          format: int32
        userLimit:
          type: integer
          format: int32
        id:
          type: string
    UpsertCompany:
      type: object
      properties:
        name:
          type: string
        domains:
          type: array
          items:
            type: string
        passwordExpirationDays:
          type: integer
          format: int32
        slug:
          type: string
        customDashboardUrl:
          type: string
    UpsertCompanyAdministrativeData:
      type: object
      properties:
        legalEntity:
          type: string
        licenseNumber:
          type: string
        email:
          type: string
        vatNumber:
          type: string
        legalAddress1:
          type: string
        legalAddress2:
          type: string
        city:
          type: string
        state:
          type: string
        zip:
          type: string
        country:
          type: string
    CompanyInviteDTO:
      type: object
      properties:
        id:
          type: string
        companyId:
          type: string
        invitedBy:
          type: string
        invitedById:
          type: string
        email:
          type: string
        deletedOn:
          type: string
          format: date-time
        validUntil:
          type: string
          format: date-time
        updatedOn:
          type: string
          format: date-time
        status:
          type: string
        role:
          type: string
    CompanyInviteRequest:
      type: object
      properties:
        email:
          type: string
        role:
          type: string
          enum:
          - ADMIN
          - ACCOUNTING
          - READONLY
    PaginatedCompanyInvite:
      type: object
      properties:
        items:
          type: array
          items:
            $ref: "#/components/schemas/CompanyInviteDTO"
        limit:
          type: integer
          format: int32
        offset:
          type: integer
          format: int32
    PagingObjectCompanyInviteDTO:
      type: object
      properties:
        items:
          type: array
          items:
            $ref: "#/components/schemas/CompanyInviteDTO"
        limit:
          type: integer
          format: int32
        offset:
          type: integer
          format: int32
    ConnectorDTO:
      type: object
      properties:
        id:
          type: string
        name:
          type: string
        description:
          type: string
        iconBase64:
          type: string
        authConfiguration:
          $ref: "#/components/schemas/JsonNode"
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
        active:
          type: boolean
        publicAvailable:
          type: boolean
        resolver:
          type: string
        isAuthenticated:
          type: boolean
    ConnectorInstanceSafeDTO:
      type: object
      properties:
        id:
          type: string
        connectorId:
          type: string
        name:
          type: string
        status:
          type: string
          enum:
          - ACTIVE
          - INACTIVE
          - ERROR
          - SYNCING
          - CONFIGURATION_REQUIRED
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
        lastSyncAt:
          type: string
          format: date-time
    ConnectorFlowInstanceJobStatusDTO:
      type: object
      properties:
        id:
          type: string
        connectorFlowInstanceId:
          type: string
        jobId:
          type: string
        status:
          type: string
          enum:
          - STARTED
          - IN_PROGRESS
          - SUCCESS
          - PARTIAL_SUCCESS
          - FAILED
          - CANCELLED
          - TIMEOUT
        completedAt:
          type: string
          format: date-time
        totalRecords:
          type: integer
          format: int32
        successfulRecords:
          type: integer
          format: int32
        failedRecords:
          type: integer
          format: int32
        errorMessage:
          type: string
        errorDetails:
          type: string
        logs:
          $ref: "#/components/schemas/JsonNode"
        externalReference:
          type: string
        createdAt:
          type: string
          format: date-time
    RecordJobStatusRequest:
      type: object
      properties:
        jobId:
          type: string
        status:
          type: string
        completedAt:
          type: string
          format: date-time
        totalRecords:
          type: integer
          format: int32
        successfulRecords:
          type: integer
          format: int32
        failedRecords:
          type: integer
          format: int32
        errorMessage:
          type: string
        errorDetails:
          type: string
        logs:
          $ref: "#/components/schemas/JsonNode"
        externalReference:
          type: string
    AuthResponse:
      type: object
      properties:
        action:
          type: string
          enum:
          - PASS_TO_FRONTEND
          - STORE
        data:
          $ref: "#/components/schemas/ObjectNode"
        message:
          type: string
    ObjectNode:
      type: object
      oneOf:
      - $ref: "#/components/schemas/AmazonS3Configuration"
      - $ref: "#/components/schemas/CodeDataSourceConfiguration"
      - $ref: "#/components/schemas/FileDataSourceConfiguration"
      - $ref: "#/components/schemas/SFTPDataSourceConfiguration"
      - $ref: "#/components/schemas/SalesforceConfiguration"
    CreateConnectorInstanceRequest:
      type: object
      properties:
        connectorId:
          type: string
        name:
          type: string
        authParams:
          $ref: "#/components/schemas/ObjectNode"
    ConnectorFlowInstanceDTO:
      type: object
      properties:
        id:
          type: string
        connectorFlowId:
          type: string
        connectorInstanceId:
          type: string
        resolver:
          type: string
        params:
          $ref: "#/components/schemas/JsonNode"
        mappings:
          $ref: "#/components/schemas/JsonNode"
        status:
          type: string
          enum:
          - ACTIVE
          - PAUSED
          - ERROR
          - RUNNING
          - CONFIGURATION_REQUIRED
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
        lastExecutionAt:
          type: string
          format: date-time
    ArrayNode:
      type: object
    CreateFlowInstanceRequest:
      type: object
      properties:
        connectorInstanceId:
          type: string
        audienceId:
          type: string
        params:
          $ref: "#/components/schemas/ArrayNode"
        mappings:
          $ref: "#/components/schemas/ArrayNode"
        sendNow:
          type: boolean
    ConnectorFlowInstanceSafeDTO:
      type: object
      properties:
        id:
          type: string
        connectorFlowId:
          type: string
        connectorInstanceId:
          type: string
        connectorName:
          type: string
        params:
          $ref: "#/components/schemas/JsonNode"
        mappings:
          $ref: "#/components/schemas/JsonNode"
        status:
          type: string
          enum:
          - ACTIVE
          - PAUSED
          - ERROR
          - RUNNING
          - CONFIGURATION_REQUIRED
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
        lastExecutionAt:
          type: string
          format: date-time
    ConnectorFlowDTO:
      type: object
      properties:
        id:
          type: string
        connectorId:
          type: string
        name:
          type: string
        description:
          type: string
        configuration:
          $ref: "#/components/schemas/JsonNode"
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
        active:
          type: boolean
        enabled:
          type: boolean
    ConnectorInstanceDTO:
      type: object
      properties:
        id:
          type: string
        connectorId:
          type: string
        name:
          type: string
        resolver:
          type: string
        credentials:
          $ref: "#/components/schemas/JsonNode"
        status:
          type: string
          enum:
          - ACTIVE
          - INACTIVE
          - ERROR
          - SYNCING
          - CONFIGURATION_REQUIRED
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
        lastSyncAt:
          type: string
          format: date-time
    PrepareFlowStepRequest:
      type: object
      properties:
        params:
          $ref: "#/components/schemas/ArrayNode"
        additionalProperties:
          type: object
          additionalProperties:
            type: object
        additionalPropertiesAsJsonNode:
          $ref: "#/components/schemas/JsonNode"
    ActivateDataSourceBody:
      type: object
      properties:
        status:
          type: string
          enum:
          - CONFIGURATION_REQUIRED
          - PENDING
          - ACTIVATING
          - ACTIVE
          - INACTIVE
          - ERROR
    AccountConnector:
      type: object
      properties:
        Id:
          type: integer
          format: int32
        Name:
          type: string
        AuthValue:
          type: string
        Description:
          type: string
        Connector:
          $ref: "#/components/schemas/Connector"
        Properties:
          type: array
          items:
            $ref: "#/components/schemas/AccountConnectorProperty"
        Authenticated:
          type: boolean
    AccountConnectorProperty:
      type: object
      properties:
        Name:
          type: string
        Value:
          type: string
        Id:
          type: integer
          format: int32
        AccountConnectorId:
          type: integer
          format: int32
    AmazonS3Configuration:
      type: object
      properties:
        isDefaultHeader:
          type: boolean
        type:
          type: string
          enum:
          - CUSTOMER
          - EVENT
        headers:
          type: array
          items:
            $ref: "#/components/schemas/FileHeader"
        normalizeAddresses:
          type: boolean
        s3Endpoint:
          type: string
        bucketArn:
          type: string
        path:
          type: string
        region:
          type: string
        accessKey:
          type: string
        secretKey:
          type: string
        roleArn:
          type: string
        storagePath:
          type: string
    CodeDataSourceConfiguration:
      type: object
      properties:
        url:
          type: string
        headers:
          type: array
          items:
            $ref: "#/components/schemas/FileHeader"
    Connector:
      type: object
      properties:
        Id:
          type: string
        AccountConnectorId:
          type: string
        Name:
          type: string
        Description:
          type: string
        Version:
          type: string
        Icon:
          type: string
        Parameters:
          type: array
          items:
            $ref: "#/components/schemas/FieldOrParameter"
        Categories:
          type: array
          items:
            type: string
    CreateUpdateDataSourceResponse:
      type: object
      properties:
        dataSource:
          $ref: "#/components/schemas/DataSourceDTO"
        integrationsResult:
          $ref: "#/components/schemas/IntegrationsResult"
    Cycle:
      type: object
      properties:
        Id:
          type: string
        Name:
          type: string
        Description:
          type: string
        CreatedOnUtc:
          type: string
        Connectors:
          type: array
          items:
            $ref: "#/components/schemas/Connector"
        Status:
          type: string
          enum:
          - Stopped
          - Active
          - Launching
          - Finish
        TemplateId:
          type: string
        TemplateReleaseId:
          type: string
        Prerequisites:
          type: array
          items:
            $ref: "#/components/schemas/CyclePrerequisite"
        Variables:
          type: array
          items:
            $ref: "#/components/schemas/CycleVariable"
        Tags:
          type: array
          items:
            type: string
    CyclePrerequisite:
      type: object
      properties:
        Step:
          $ref: "#/components/schemas/StepPrerequisite"
        Parameters:
          type: array
          items:
            $ref: "#/components/schemas/StepParameter"
    CycleVariable:
      type: object
      properties:
        DisplayName:
          type: string
        SystemName:
          type: string
        Value:
          type: string
        MappingType:
          type: string
          enum:
          - Ignore
          - PreviousStep
          - StaticValue
          - TriggerMethod
          - ValueList
          - CycleVariable
    CyclrResult:
      type: object
      properties:
        cycle:
          $ref: "#/components/schemas/Cycle"
        status:
          type: string
          enum:
          - AUTHENTICATION_REQUIRED
          - PARAMETERS_REQUIRED
          - ACTIVABLE
          - ACTIVE
          - STOPPED
          - ERROR
          - NOT_FOUND
        message:
          type: string
        action:
          $ref: "#/components/schemas/InstallTemplateAction"
    DataSourceConfiguration:
      type: object
      anyOf:
      - $ref: "#/components/schemas/AmazonS3Configuration"
      - $ref: "#/components/schemas/CodeDataSourceConfiguration"
      - $ref: "#/components/schemas/FileDataSourceConfiguration"
      - $ref: "#/components/schemas/OtherDataSourceConfiguration"
      - $ref: "#/components/schemas/SFTPDataSourceConfiguration"
      - $ref: "#/components/schemas/SalesforceConfiguration"
    DataSourceDTO:
      type: object
      properties:
        type:
          $ref: "#/components/schemas/DataSourceTypeDTO"
        workspaceId:
          type: string
        name:
          type: string
        slug:
          type: string
        status:
          type: string
          enum:
          - CONFIGURATION_REQUIRED
          - PENDING
          - ACTIVATING
          - ACTIVE
          - INACTIVE
          - ERROR
        configuration:
          $ref: "#/components/schemas/DataSourceConfiguration"
        createdOn:
          type: string
          format: date-time
        activatedOn:
          type: string
          format: date-time
        id:
          type: string
    DataSourceTypeDTO:
      type: object
      properties:
        name:
          type: string
        category:
          type: string
          enum:
          - CODE
          - CRM
          - FILE
        configuration:
          $ref: "#/components/schemas/JsonNode"
        id:
          type: string
          enum:
          - AMAZON_S3
          - CSV_FILE
          - ENCRYPTED_CSV_FILE
          - GOOGLE_TAG_MANAGER
          - INGESTION_API
          - SALESFORCE
          - SFTP
          - WEBSITE_JS
          - WORDPRESS
    FieldOrParameter:
      type: object
      properties:
        TargetType:
          type: string
          enum:
          - Index
          - HttpHeader
          - MergeField
          - QueryString
          - FilterField
          - ResponseField
          - Script
        TargetName:
          type: string
        IsSensitive:
          type: boolean
        Id:
          type: integer
          format: int32
        Name:
          type: string
        Description:
          type: string
        IsOptional:
          type: boolean
        DataType:
          type: string
        TriggerName:
          type: string
        Values:
          type: array
          items:
            type: string
        DisplayOrder:
          type: integer
          format: int32
        Triggers:
          type: array
          items:
            $ref: "#/components/schemas/Trigger"
    FileDataSourceConfiguration:
      type: object
      properties:
        isDefaultHeader:
          type: boolean
        type:
          type: string
          enum:
          - CUSTOMER
          - EVENT
        headers:
          type: array
          items:
            $ref: "#/components/schemas/FileHeader"
        normalizeAddresses:
          type: boolean
        s3Key:
          type: string
        url:
          type: string
    FileHeader:
      type: object
      properties:
        name:
          type: string
        skip:
          type: boolean
        traitId:
          type: string
        displayName:
          type: string
        customDataType:
          type: string
          enum:
          - TEXT
          - NUMBER
          - DATE
          - DATETIME
          - BOOLEAN
        custom:
          type: boolean
    InstallTemplateAction:
      type: object
    IntegrationsResult:
      type: object
      properties:
        cyclr:
          $ref: "#/components/schemas/CyclrResult"
    OtherDataSourceConfiguration:
      type: object
      properties:
        headers:
          type: array
          items:
            $ref: "#/components/schemas/FileHeader"
    SFTPDataSourceConfiguration:
      type: object
      properties:
        isDefaultHeader:
          type: boolean
        type:
          type: string
          enum:
          - CUSTOMER
          - EVENT
        headers:
          type: array
          items:
            $ref: "#/components/schemas/FileHeader"
        normalizeAddresses:
          type: boolean
        host:
          type: string
        port:
          type: integer
          format: int32
        username:
          type: string
        password:
          type: string
        privateKey:
          type: string
        passphrase:
          type: string
        storagePath:
          type: string
        path:
          type: string
    SalesforceConfiguration:
      type: object
      properties:
        headers:
          type: array
          items:
            $ref: "#/components/schemas/FileHeader"
    StepParameter:
      type: object
      properties:
        Parameter:
          $ref: "#/components/schemas/FieldOrParameter"
        MappingType:
          type: string
          enum:
          - Ignore
          - PreviousStep
          - StaticValue
          - TriggerMethod
          - ValueList
          - CycleVariable
        SourceFieldId:
          type: integer
          format: int32
        SourceStepId:
          type: string
        TriggerValue:
          type: string
        TriggerValueDisplayName:
          type: string
        Value:
          type: string
    StepPrerequisite:
      type: object
      properties:
        Id:
          type: string
        Name:
          type: string
        ActionType:
          type: string
        AccountConnector:
          $ref: "#/components/schemas/AccountConnector"
        WebhookIdentifier:
          type: string
        WebhookUrl:
          type: string
    Trigger:
      type: object
      properties:
        AccountConnectorId:
          type: integer
          format: int32
        EntityId:
          type: integer
          format: int32
        TriggerType:
          type: string
          enum:
          - Field
          - Parameter
        TriggerId:
          type: integer
          format: int32
        MethodId:
          type: integer
          format: int32
        Name:
          type: string
        HumanReadableKey:
          type: string
        IdentifierKey:
          type: string
    PresignedUrl:
      type: object
      properties:
        url:
          type: string
        expiration:
          type: string
          format: date-time
    DataSourceSetup:
      type: object
      properties:
        setup:
          $ref: "#/components/schemas/JsonNode"
    DataSourceCSVStatsDTO:
      type: object
      properties:
        txId:
          type: string
        blobName:
          type: string
        parseErrorBlobName:
          type: string
        ingestionErrorBlobName:
          type: string
        createdOn:
          type: string
          format: date-time
        updatedOn:
          type: string
          format: date-time
        totalCount:
          type: integer
          format: int64
        ok:
          type: integer
          format: int64
        parseError:
          type: integer
          format: int64
        ingestionError:
          type: integer
          format: int64
    EventDTO:
      type: object
      properties:
        timestamp:
          type: string
          format: date-time
        type:
          type: string
        name:
          type: string
        path:
          type: string
        channel:
          type: string
        event:
          $ref: "#/components/schemas/JsonNode"
    DataSourceStats:
      type: object
      properties:
        events:
          type: integer
          format: int64
        users:
          type: integer
          format: int64
        traits:
          type: integer
          format: int64
    DataSourceList:
      type: array
      properties:
        empty:
          type: boolean
        first:
          $ref: "#/components/schemas/DataSourceDTO"
        last:
          $ref: "#/components/schemas/DataSourceDTO"
      items:
        $ref: "#/components/schemas/DataSourceDTO"
    PagedDataSources:
      type: object
      properties:
        items:
          type: array
          items:
            $ref: "#/components/schemas/DataSourceDTO"
        limit:
          type: integer
          format: int32
        offset:
          type: integer
          format: int32
    PagingObjectDataSourceDTO:
      type: object
      properties:
        items:
          type: array
          items:
            $ref: "#/components/schemas/DataSourceDTO"
        limit:
          type: integer
          format: int32
        offset:
          type: integer
          format: int32
    DataSourceStatus:
      type: object
      properties:
        status:
          type: string
    DataSourceDependencies:
      type: object
      properties:
        audiences:
          type: array
          items:
            $ref: "#/components/schemas/AudienceLightDTO"
    DataSourceCustomProperties:
      type: object
      properties:
        properties:
          type: array
          items:
            $ref: "#/components/schemas/DataSourceCustomProperty"
    DataSourceCustomProperty:
      type: object
      properties:
        displayName:
          type: string
        normalizedProperty:
          type: string
        property:
          type: string
        type:
          type: string
          enum:
          - TEXT
          - NUMBER
          - DATE
          - DATETIME
          - BOOLEAN
    DataSourceTraitDistributions:
      type: object
      properties:
        distributions:
          type: array
          items:
            $ref: "#/components/schemas/EventTraitDistribution"
        id:
          type: string
    InsertDataSourceBody:
      type: object
      properties:
        name:
          type: string
        type:
          type: string
          enum:
          - AMAZON_S3
          - CSV_FILE
          - ENCRYPTED_CSV_FILE
          - GOOGLE_TAG_MANAGER
          - INGESTION_API
          - SALESFORCE
          - SFTP
          - WEBSITE_JS
          - WORDPRESS
        configuration:
          $ref: "#/components/schemas/ObjectNode"
    UpdateDataSourceBody:
      type: object
      properties:
        name:
          type: string
        activate:
          type: boolean
        configuration:
          $ref: "#/components/schemas/JsonNode"
    CyclrUpdateField:
      type: object
      properties:
        stepId:
          type: string
        fieldId:
          type: integer
          format: int32
        mappingType:
          type: string
          enum:
          - Ignore
          - PreviousStep
          - StaticValue
          - TriggerMethod
          - ValueList
          - CycleVariable
        value:
          type: string
        customFieldName:
          type: string
    CyclrUpdateFieldsBody:
      type: object
      properties:
        fields:
          type: array
          items:
            $ref: "#/components/schemas/CyclrUpdateField"
    CyclrUpdateParameter:
      type: object
      properties:
        isAccountConnectorParameter:
          type: boolean
        stepIds:
          type: array
          items:
            type: string
        parameterId:
          type: integer
          format: int32
        mappingType:
          type: string
          enum:
          - Ignore
          - PreviousStep
          - StaticValue
          - TriggerMethod
          - ValueList
          - CycleVariable
        value:
          type: string
        name:
          type: string
        propertyId:
          type: integer
          format: int32
        accountConnectorId:
          type: integer
          format: int32
    CyclrUpdateParametersBody:
      type: object
      properties:
        parameters:
          type: array
          items:
            $ref: "#/components/schemas/CyclrUpdateParameter"
    DataSourceActivationBody:
      type: object
      properties:
        workspaceId:
          type: string
        datasourceId:
          type: string
        origin:
          type: string
    DataSourceRuleDTO:
      type: object
      properties:
        name:
          type: string
        slug:
          type: string
        type:
          type: string
        datasourceId:
          type: string
        configuration:
          $ref: "#/components/schemas/JsonNode"
        id:
          type: string
    DataSourceRulesDTO:
      type: object
      properties:
        updatedOn:
          type: string
          format: date-time
        rules:
          type: array
          items:
            $ref: "#/components/schemas/DataSourceRuleDTO"
    Track:
      type: object
      properties:
        type:
          type: string
        element:
          type: string
        selector:
          type: string
    View:
      type: object
      properties:
        path:
          type: string
    DataSourceWithRulesDTO:
      type: object
      properties:
        id:
          type: string
        status:
          type: string
          enum:
          - CONFIGURATION_REQUIRED
          - PENDING
          - ACTIVATING
          - ACTIVE
          - INACTIVE
          - ERROR
        updatedOn:
          type: string
          format: date-time
        type:
          type: string
        category:
          type: string
        rules:
          type: array
          items:
            $ref: "#/components/schemas/DataSourceRuleDTO"
    CreateDatasourceRuleBody:
      type: object
      properties:
        name:
          type: string
        type:
          type: string
          enum:
          - TRACK
          - VIEW
          - CUSTOM
        configuration:
          $ref: "#/components/schemas/JsonNode"
    CreateDatasourceRulesBody:
      type: object
      properties:
        rules:
          type: array
          items:
            $ref: "#/components/schemas/CreateDatasourceRuleBody"
    DatasourceRuleList:
      type: array
      properties:
        empty:
          type: boolean
        first:
          $ref: "#/components/schemas/DataSourceRuleDTO"
        last:
          $ref: "#/components/schemas/DataSourceRuleDTO"
      items:
        $ref: "#/components/schemas/DataSourceRuleDTO"
    UpdateDatasourceRuleBody:
      type: object
      properties:
        name:
          type: string
    CreateUpdateDistributionChannelResponse:
      type: object
      properties:
        distributionChannel:
          $ref: "#/components/schemas/DistributionChannelDTO"
        integrationsResult:
          $ref: "#/components/schemas/IntegrationsResult"
    DistributionChannelDTO:
      type: object
      properties:
        name:
          type: string
        destination:
          type: string
        status:
          type: string
        configuration:
          $ref: "#/components/schemas/JsonNode"
        mergeStrategy:
          type: string
          enum:
          - ARBITRARY
        allowAddUsers:
          type: boolean
        allowUpdateUsers:
          type: boolean
        allowRemoveUsers:
          type: boolean
        integrationType:
          type: string
        integrationPartner:
          type: string
          enum:
          - CYCLR
        audience:
          $ref: "#/components/schemas/AudienceLightDTO"
        trait:
          $ref: "#/components/schemas/TraitDTO"
        audienceTrait:
          $ref: "#/components/schemas/TraitDTO"
        createdOn:
          type: string
          format: date-time
        settings:
          $ref: "#/components/schemas/JsonNode"
        id:
          type: string
        audienceId:
          type: string
    CreateDistributionChannelBody:
      type: object
      properties:
        integrationPartner:
          type: string
          enum:
          - CYCLR
        configuration:
          $ref: "#/components/schemas/JsonNode"
    CyclrInstallTemplateConfiguration:
      type: object
      properties:
        templateId:
          type: string
        templateName:
          type: string
    CyclrTransactionDTO:
      type: object
      properties:
        LastRunTimestamp:
          type: string
        HasErrors:
          type: boolean
    UpdateDistributionChannelBody:
      type: object
      properties:
        allowAddUsers:
          type: boolean
        allowUpdateUsers:
          type: boolean
        allowRemoveUsers:
          type: boolean
        traitId:
          type: string
        activate:
          type: boolean
    InstallAndAuthenticateConnectorRequestDTO:
      type: object
      properties:
        connectorName:
          type: string
        integrationPartner:
          type: string
          enum:
          - CYCLR
        params:
          $ref: "#/components/schemas/JsonNode"
    DeauthenticateConnectorRequestDTO:
      type: object
      properties:
        integrationPartner:
          type: string
          enum:
          - CYCLR
        connectorName:
          type: string
    DistributionChannelConnectorDTO:
      type: object
      properties:
        name:
          type: string
        description:
          type: string
        installed:
          type: boolean
        authenticated:
          type: boolean
        integrationPartner:
          type: string
          enum:
          - CYCLR
        accountConnectorId:
          type: integer
          format: int32
        icon:
          type: string
    InstallAndAuthenticateConnectorResponseDTO:
      type: object
      properties:
        connector:
          $ref: "#/components/schemas/DistributionChannelConnectorDTO"
        token:
          type: string
        authUrl:
          type: string
    UploadResponse:
      type: object
      properties:
        url:
          type: string
        path:
          type: string
    CreatePresignedURLBody:
      type: object
      properties:
        encrypted:
          type: boolean
        filename:
          type: string
    FileS3TestConnectionBody:
      required:
      - accessKey
      - bucketArn
      - region
      - secretKey
      type: object
      properties:
        s3Endpoint:
          type: string
          description: S3 endpoint URL
          example: https://s3.amazonaws.com
        bucketArn:
          type: string
          description: ARN of the S3 bucket
          example: arn:aws:s3:::mybucket
        path:
          type: string
          description: Path within the S3 bucket
          example: /folder/file.csv
        region:
          type: string
          description: AWS region
          example: us-east-1
        accessKey:
          type: string
          description: Access key for AWS credentials
          example: AKIA...
        secretKey:
          type: string
          description: Secret key for AWS credentials
          example: abc123...
        roleArn:
          type: string
          description: Role ARN for assuming a role
          example: arn:aws:iam::123456789012:role/my-role
        limit:
          type: integer
          description: Maximum number of rows to retrieve
          format: int32
          example: 100
      description: Request body containing S3 connection and query parameters.
    FileSFTPConnectionBody:
      required:
      - host
      - path
      - username
      type: object
      properties:
        host:
          type: string
          description: SFTP server host
          example: my.sftp.server.com
        port:
          type: integer
          description: SFTP server port
          format: int32
          default: 22
        username:
          type: string
          description: The account username
        password:
          type: string
          description: "The account password. Either the password or the private key\
            \ can be present, but not both."
        privateKey:
          type: string
          description: "The private key in .PEM format. Either the password or the\
            \ private key can be present, but not both."
        passphrase:
          type: string
          description: "The private key passphrase, only if it is encrypted"
        path:
          type: string
          description: Path within the SFTP server
          example: /folder/file.csv
        limit:
          type: integer
          description: Maximum number of rows to retrieve
          format: int32
          example: 100
      description: Request body containing SFTP connection and query parameters.
    Template:
      type: object
      properties:
        Id:
          type: string
        Name:
          type: string
        Description:
          type: string
        Connectors:
          type: array
          items:
            $ref: "#/components/schemas/Connector"
        Tags:
          type: array
          items:
            type: string
    CompetitorDetail:
      type: object
      properties:
        name:
          type: string
        url:
          type: string
        tagline:
          type: string
        geographicPresence:
          type: string
    MarketIntelligenceResultDTO:
      type: object
      properties:
        reportId:
          type: string
        status:
          type: string
          enum:
          - PENDING
          - RUNNING_STEP1
          - RUNNING_STEP2
          - RUNNING_STEP3
          - DONE
          - ERROR
        errorKind:
          type: string
          enum:
          - TRANSIENT
          - PERMANENT
        errorMessage:
          type: string
        retryCount:
          type: integer
          format: int32
        sector:
          type: string
        location:
          type: string
        effectiveScope:
          type: string
          enum:
          - LOCAL
          - NATIONAL
          - GLOBAL
        aiSuggestedScope:
          type: string
          enum:
          - LOCAL
          - NATIONAL
          - GLOBAL
        userScope:
          type: string
          enum:
          - LOCAL
          - NATIONAL
          - GLOBAL
        report:
          $ref: "#/components/schemas/MarketReport"
        createdOn:
          type: string
          format: date-time
        updatedOn:
          type: string
          format: date-time
    MarketReport:
      type: object
      properties:
        competitors:
          type: array
          items:
            $ref: "#/components/schemas/CompetitorDetail"
        strengths:
          type: array
          items:
            $ref: "#/components/schemas/StrengthItem"
        competitorsEdge:
          type: array
          items:
            $ref: "#/components/schemas/StrengthItem"
        targetingOpportunity:
          type: string
        defenseStrategy:
          type: string
    StrengthItem:
      type: object
      properties:
        title:
          type: string
        description:
          type: string
    PagingObject:
      type: object
      properties:
        items:
          type: array
          items:
            type: object
        limit:
          type: integer
          format: int32
        offset:
          type: integer
          format: int32
    PagingObjectMarketIntelligenceResultDTO:
      type: object
      properties:
        items:
          type: array
          items:
            $ref: "#/components/schemas/MarketIntelligenceResultDTO"
        limit:
          type: integer
          format: int32
        offset:
          type: integer
          format: int32
    MarketIntelligenceStartDTO:
      type: object
      properties:
        reportId:
          type: string
        status:
          type: string
          enum:
          - PENDING
          - RUNNING_STEP1
          - RUNNING_STEP2
          - RUNNING_STEP3
          - DONE
          - ERROR
    PipelineErrorBody:
      type: object
      properties:
        errorMessage:
          type: string
        kind:
          type: string
          enum:
          - TRANSIENT
          - PERMANENT
    PipelineReportBody:
      type: object
      properties:
        report:
          $ref: "#/components/schemas/JsonNode"
    StartAnalysisBody:
      type: object
      properties:
        clientUrl:
          type: string
        competitorUrls:
          type: array
          items:
            type: string
        sector:
          type: string
        scope:
          type: string
          enum:
          - LOCAL
          - NATIONAL
          - GLOBAL
        language:
          type: string
    PipelineCompetitorsBody:
      type: object
      properties:
        results:
          $ref: "#/components/schemas/JsonNode"
    PipelineStatusUpdateBody:
      type: object
      properties:
        status:
          type: string
          enum:
          - PENDING
          - RUNNING_STEP1
          - RUNNING_STEP2
          - RUNNING_STEP3
          - DONE
          - ERROR
    PipelineStep1ResultBody:
      type: object
      properties:
        sector:
          type: string
        location:
          type: string
        aiSuggestedScope:
          type: string
          enum:
          - LOCAL
          - NATIONAL
          - GLOBAL
        effectiveScope:
          type: string
          enum:
          - LOCAL
          - NATIONAL
          - GLOBAL
    MetricsDTO:
      type: object
      properties:
        activeAudienceCount:
          type: integer
          description: Number of active audiences
          format: int32
          example: 5
        activeDataSourceCount:
          type: integer
          description: Number of active data sources
          format: int32
          example: 3
        totalAudienceSize:
          type: integer
          description: Total size of all audiences
          format: int64
          example: 15000
        totalDataSourceSize:
          type: integer
          description: Total size of all data sources
          format: int64
          example: 500000
        distributionChannels:
          type: object
          additionalProperties:
            type: integer
            description: Distribution channels grouped by status
            format: int32
          description: Distribution channels grouped by status
          example:
            ACTIVE: 2
            CONFIGURATION_REQUIRED: 1
            ERROR: 9
            STOPPED: 7
            PENDING: 3
        audienceSizeHistory:
          type: object
          additionalProperties:
            type: integer
            description: Historical monthly average audience sizes
            format: int64
          description: Historical monthly average audience sizes
          example:
            "2025-01": 10000
            "2025-02": 10500
            "2025-03": 11000
        dataSourceSize:
          type: object
          additionalProperties:
            type: integer
            description: Data sources size grouped by type
            format: int64
          description: Data sources size grouped by type
          example:
            AMAZON_S3: 150000
            CSV_FILE: 200000
            ENCRYPTED_CSV_FILE: 170000
            GOOGLE_TAG_MANAGER: 13000
            INGESTION_API: 159000
            SALESFORCE: 75000
            SFTP: 5000
            WEBSITE_JS: 300000
    Scope:
      type: object
      properties:
        value:
          type: string
        description:
          type: string
    CreateSupportBody:
      type: object
      properties:
        workspaceId:
          type: string
        email:
          type: string
        message:
          type: string
    Documents:
      type: object
      properties:
        terms_and_conditions:
          $ref: "#/components/schemas/LegalDocuments"
        privacy_policy:
          $ref: "#/components/schemas/LegalDocuments"
    LegalDocuments:
      type: object
      properties:
        url:
          type: string
        version:
          type: string
    TermsAndConditionsResponse:
      type: object
      properties:
        documents:
          $ref: "#/components/schemas/Documents"
        created_at:
          type: string
          format: date-time
    CreateTermsDTO:
      required:
      - documents
      type: object
      properties:
        documents:
          $ref: "#/components/schemas/Documents"
    Traits:
      type: object
      properties:
        customer:
          type: array
          items:
            $ref: "#/components/schemas/TraitDTO"
        event:
          type: array
          items:
            $ref: "#/components/schemas/TraitDTO"
    TraitsCollection:
      type: array
      properties:
        empty:
          type: boolean
      items:
        $ref: "#/components/schemas/TraitDTO"
    UnifiedProfileDTO:
      type: object
      properties:
        addressCity:
          type: array
          items:
            type: string
        addressCountry:
          type: array
          items:
            type: string
        addressPostalCode:
          type: array
          items:
            type: string
        addressState:
          type: array
          items:
            type: string
        addressStreet:
          type: array
          items:
            type: string
        age:
          type: array
          items:
            type: string
        avatar:
          type: array
          items:
            type: string
        birthday:
          type: array
          items:
            type: string
        companyEmployeeCount:
          type: array
          items:
            type: string
        companyId:
          type: array
          items:
            type: string
        companyIndustry:
          type: array
          items:
            type: string
        companyPlan:
          type: array
          items:
            type: string
        description:
          type: array
          items:
            type: string
        gender:
          type: array
          items:
            type: string
        title:
          type: array
          items:
            type: string
        username:
          type: array
          items:
            type: string
        website:
          type: array
          items:
            type: string
        customTraits:
          $ref: "#/components/schemas/JsonNode"
        email:
          type: string
        profileCreatedAt:
          type: string
          format: date-time
        profileUpdatedAt:
          type: string
          format: date-time
        id:
          type: array
          items:
            type: string
            format: uuid
        firstName:
          type: array
          items:
            type: string
        lastName:
          type: array
          items:
            type: string
        companyName:
          type: array
          items:
            type: string
        createdAt:
          type: array
          items:
            type: string
        name:
          type: array
          items:
            type: string
        phone:
          type: array
          items:
            type: string
        datasourceIds:
          type: array
          items:
            type: string
        audienceIds:
          type: array
          items:
            type: string
    UnifiedProfileListItemDTO:
      type: object
      properties:
        email:
          type: string
        profileCreatedAt:
          type: string
          format: date-time
        profileUpdatedAt:
          type: string
          format: date-time
        datasourceIds:
          type: array
          items:
            type: string
        audienceIds:
          type: array
          items:
            type: string
        id:
          type: array
          items:
            type: string
            format: uuid
        firstName:
          type: array
          items:
            type: string
        lastName:
          type: array
          items:
            type: string
        companyName:
          type: array
          items:
            type: string
        createdAt:
          type: array
          items:
            type: string
        name:
          type: array
          items:
            type: string
        phone:
          type: array
          items:
            type: string
    PagingObjectUnifiedProfileListItemDTO:
      type: object
      properties:
        items:
          type: array
          items:
            $ref: "#/components/schemas/UnifiedProfileListItemDTO"
        limit:
          type: integer
          format: int32
        offset:
          type: integer
          format: int32
    UserRoleBody:
      type: object
      properties:
        roles:
          type: array
          items:
            type: string
            enum:
            - ADMIN
            - ACCOUNTING
            - READONLY
    CompanyCDPUserDTO:
      type: object
      properties:
        id:
          type: string
        firstName:
          type: string
        lastName:
          type: string
        email:
          type: string
        roles:
          type: array
          items:
            type: string
        invitePending:
          type: boolean
    CDPUserDTO:
      type: object
      properties:
        email:
          type: string
        firstName:
          type: string
        lastName:
          type: string
        createdOn:
          type: string
          format: date-time
        id:
          type: string
    OnboardCompanyResponse:
      type: object
      properties:
        user:
          $ref: "#/components/schemas/CDPUserDTO"
        company:
          $ref: "#/components/schemas/CompanyDTO"
        workspace:
          $ref: "#/components/schemas/WorkspaceDTO"
    OnboardCompanyBody:
      type: object
      properties:
        userEmail:
          type: string
        companyName:
          type: string
        companyLegalName:
          type: string
        companyVatNumber:
          type: string
        companyAddress:
          type: string
        companyZip:
          type: string
        companyCity:
          type: string
        companyState:
          type: string
        companyCountry:
          type: string
        companyEmail:
          type: string
        noDomains:
          type: boolean
    OnboardWorkspaceResponse:
      type: object
      properties:
        workspace:
          $ref: "#/components/schemas/WorkspaceDTO"
    OnboardWorkspaceBody:
      type: object
      properties:
        name:
          type: string
        companyId:
          type: string
        userIds:
          type: array
          items:
            type: string
    PagingObjectWorkspaceRoleDTO:
      type: object
      properties:
        items:
          type: array
          items:
            $ref: "#/components/schemas/WorkspaceRoleDTO"
        limit:
          type: integer
          format: int32
        offset:
          type: integer
          format: int32
    WorkspaceRoleDTO:
      type: object
      properties:
        roleExternalId:
          type: string
        role:
          type: string
        roleDescription:
          type: string
        workspaceExternalId:
          type: string
    Onboard:
      type: object
      properties:
        forceWorkspaceCreation:
          type: boolean
        forceCompanyCreation:
          type: boolean
        companyInvitePending:
          type: boolean
    UserInfo:
      type: object
      properties:
        workspaces:
          type: array
          items:
            $ref: "#/components/schemas/WorkspaceDTO"
        roles:
          type: array
          items:
            type: string
        onboard:
          $ref: "#/components/schemas/Onboard"
        company:
          $ref: "#/components/schemas/CompanyDTO"
        workspaceInvites:
          type: array
          items:
            $ref: "#/components/schemas/WorkspaceInviteDTO"
        termsAccepted:
          type: string
          format: date-time
    WorkspaceInviteDTO:
      type: object
      properties:
        id:
          type: string
        deletedOn:
          type: string
          format: date-time
        invitedBy:
          type: string
        invitedByEmail:
          type: string
        invitedById:
          type: string
        invitedEmail:
          type: string
        invitedUser:
          type: string
        invitedUserId:
          type: string
        status:
          type: string
        validUntil:
          type: string
          format: date-time
        workspaceId:
          type: string
        workspaceName:
          type: string
        role:
          type: string
        company:
          $ref: "#/components/schemas/CompanyDTO"
    ChangePasswordRequest:
      type: object
      properties:
        callback:
          type: string
        ttlSeconds:
          type: integer
          format: int32
    PasswordPolicyDTO:
      type: object
      properties:
        reset:
          type: boolean
    PasswordRecoveryRequest:
      type: object
      properties:
        email:
          type: string
    UpdateUserInfoBody:
      type: object
      properties:
        firstName:
          type: string
        lastName:
          type: string
        email:
          type: string
        termsAcceptedAt:
          type: string
          format: date-time
    WorkspaceUser:
      type: object
      properties:
        id:
          type: string
          format: uuid
        userId:
          type: string
          format: uuid
        workspaceId:
          type: string
          format: uuid
        createdOn:
          type: string
          format: date-time
        deletedOn:
          type: string
          format: date-time
    CreateUserBody:
      type: object
      properties:
        userExternalId:
          type: string
        role:
          type: string
    WorkspaceUserDTO:
      type: object
      properties:
        user:
          $ref: "#/components/schemas/CDPUserDTO"
        role:
          type: array
          items:
            type: string
    ChangeRoleBody:
      type: object
      properties:
        roles:
          type: array
          items:
            type: string
            enum:
            - ADMIN
            - READONLY
    PaginatedWorkspaceUsers:
      type: object
      properties:
        items:
          type: array
          items:
            $ref: "#/components/schemas/WorkspaceUserDTO"
        limit:
          type: integer
          format: int32
        offset:
          type: integer
          format: int32
    PagingObjectWorkspaceUserDTO:
      type: object
      properties:
        items:
          type: array
          items:
            $ref: "#/components/schemas/WorkspaceUserDTO"
        limit:
          type: integer
          format: int32
        offset:
          type: integer
          format: int32
    MailTemplateDTO:
      type: object
      properties:
        id:
          type: integer
          format: int64
        uuid:
          type: string
        name:
          type: string
        category:
          type: string
        subject:
          type: string
        createdAt:
          type: string
          nullable: true
        updatedAt:
          type: string
          nullable: true
    WhatsappBusinessAccountTemplatesDTO:
      type: object
      properties:
        wabaId:
          type: string
        wabaName:
          type: string
        templates:
          type: array
          items:
            $ref: "#/components/schemas/WhatsappTemplateDTO"
    WhatsappTemplateDTO:
      type: object
      properties:
        id:
          type: string
        name:
          type: string
        status:
          type: string
        category:
          type: string
        language:
          type: string
        lastModified:
          type: string
          nullable: true
    SimpleWorkspaceDTO:
      type: object
      properties:
        slug:
          type: string
        name:
          type: string
        createdOn:
          type: string
          format: date-time
        description:
          type: string
        dataAccount:
          type: string
        dataRegion:
          type: string
        ingestionUrl:
          type: string
        id:
          type: string
    WorkspaceIngestionBody:
      type: object
      properties:
        status:
          type: string
          enum:
          - PENDING
          - ACTIVE
          - ERROR
          - DELETED
        dataRegion:
          type: string
        dataAccount:
          type: string
        ingestionUrl:
          type: string
    WorkspaceInviteRequest:
      required:
      - email
      - role
      type: object
      properties:
        email:
          type: string
        role:
          type: string
          enum:
          - ADMIN
          - READONLY
    PaginatedWorkspaceInvite:
      type: object
      properties:
        items:
          type: array
          items:
            $ref: "#/components/schemas/WorkspaceInviteDTO"
        limit:
          type: integer
          format: int32
        offset:
          type: integer
          format: int32
    PagingObjectWorkspaceInviteDTO:
      type: object
      properties:
        items:
          type: array
          items:
            $ref: "#/components/schemas/WorkspaceInviteDTO"
        limit:
          type: integer
          format: int32
        offset:
          type: integer
          format: int32
    WorkspaceResourceDTO:
      type: object
      properties:
        id:
          type: string
        name:
          type: string
    WorkspaceResourcesDTO:
      type: object
      properties:
        dataSources:
          type: array
          items:
            $ref: "#/components/schemas/WorkspaceResourceDTO"
        audiences:
          type: array
          items:
            $ref: "#/components/schemas/WorkspaceResourceDTO"
        distributionChannels:
          type: array
          items:
            $ref: "#/components/schemas/WorkspaceResourceDTO"
    WorkspaceDetailedResourcesDTO:
      type: object
      properties:
        user:
          $ref: "#/components/schemas/CDPUserDTO"
        workspace:
          $ref: "#/components/schemas/WorkspaceDTO"
        campaigns:
          type: array
          items:
            $ref: "#/components/schemas/CampaignDTO"
        dataSources:
          type: array
          items:
            $ref: "#/components/schemas/DataSourceDTO"
        audiences:
          type: array
          items:
            $ref: "#/components/schemas/AudienceDTO"
        distributionChannels:
          type: array
          items:
            $ref: "#/components/schemas/DistributionChannelDTO"
    CreateUpdateWorkspaceBody:
      type: object
      properties:
        name:
          type: string
        slug:
          type: string
        billingEmail:
          type: string
        description:
          type: string
        workloadType:
          type: string
          enum:
          - SHARED
          - DEDICATED
    WorkspaceEncryptionPublicKeyDTO:
      type: object
      properties:
        publicKeyRing:
          type: string
        keyId:
          type: integer
          format: int64
    WorkspaceUsageSummaryDTO:
      type: object
      properties:
        eventsQuota:
          type: integer
          format: int32
        eventsLeft:
          type: integer
          format: int32
        realTimeAudienceQuota:
          type: integer
          format: int32
        realTimeAudienceLeft:
          type: integer
          format: int32
    PagedWorkspaces:
      type: object
      properties:
        items:
          type: array
          items:
            $ref: "#/components/schemas/WorkspaceDTO"
        limit:
          type: integer
          format: int32
        offset:
          type: integer
          format: int32
    PagingObjectWorkspaceDTO:
      type: object
      properties:
        items:
          type: array
          items:
            $ref: "#/components/schemas/WorkspaceDTO"
        limit:
          type: integer
          format: int32
        offset:
          type: integer
          format: int32
  securitySchemes:
    oauth2:
      type: oauth2
      flows:
        authorizationCode:
          authorizationUrl: https://audiencerate.eu.auth0.com/authorize
          tokenUrl: https://audiencerate.eu.auth0.com/oauth/token
          scopes:
            admin:read:partners: "ADMIN Reads partners info Tags: workspace"
            admin:write:partners: "ADMIN Create, Update and Delete partners Tags:\
              \ workspace"
            admin:write:users: "ADMIN Create, Update and Delete users and gives the\
              \ ability to onboard users Tags: workspace"
            admin:read:users: ADMIN Reads all users info
            admin:activate:datasource: "ADMIN Activate datasource Tags: workspace"
            admin:rules:datasource: "ADMIN Get datasource rules Tags: workspace"
            admin:audiences:datasource: ADMIN Get datasource audiences
            admin:write:cardoperations: ADMIN Create card operations
            admin:write:audiences: ADMIN Write audiences
            admin:read:audiences: ADMIN Read audiences
            admin:write:workspaces: ADMIN Write workspaces (for ingestion)
            read:scopes: "Reads scopes available Tags: workspace"
            read:users: "Reads workspace's users Tags: workspace"
            write:users: "Create, Update and Delete permissions on workspace's users\
              \ Tags: workspace, company_admin"
            read:roles: "Reads workspace roles Tags: workspace"
            write:roles: "Create, Update and Delete permissions on roles Tags: workspace"
            read:workspaces: "Reads workspaces Tags: base, workspace"
            write:workspaces: "Create, Update and Delete permissions on workspaces\
              \ Tags: base, workspace"
            read:datasource: "Reads data sources Tags: workspace"
            write:datasource: "Create, Update and Delete data sources Tags: workspace"
            read:audience: "Reads audiences Tags: workspace"
            write:audience: "Create, Update and Delete audiences Tags: workspace"
            write:rule: "Create, Update and Delete datasource rules Tags: workspace"
            read:rule: "Reads datasource rules Tags: workspace"
            read:trait: "Read traits Tags: workspace"
            read:channels: "Read Distribution channels Tags: workspace"
            write:channels: "Write Distribution channels Tags: workspace"
            read:billing: "Read billing and usage information Tags: workspace, company_admin,\
              \ company_readonly"
            read:workspacesinvite: "Read invited workspace-users info Tags: workspace"
            write:workspacesinvite: "Write invited workspace-users info Tags: workspace"
            read:companyinvite: "Read invited company-users info Tags: company_admin,\
              \ company_readonly"
            write:companyinvite: "Write invited company-users info Tags: company_admin"
            read:company: "Read Company information Tags: base, company_admin, company_accounting,\
              \ company_readonly"
            read:companyworkspaces: "Read Company workspaces information Tags: company_admin,\
              \ company_readonly"
            write:company: "Write Company information Tags: base, company_admin"
            read:administrative: "Read company administrative data Tags: company_admin,\
              \ company_accounting"
            write:administrative: "Write company administrative data Tags: company_admin,\
              \ company_accounting"
            read:campaign: "Read campaign data Tags: base, workspace"
            write:campaign: "Write campaign data Tags: base, workspace"
            read:unifiedprofile: "Read unified-profiles data Tags: base, workspace"
            read:mireport: "Read Market Intelligence reports Tags: workspace"
            write:mireport: "Create, Retry and Delete Market Intelligence reports\
              \ Tags: workspace"