FirstPromoter Affiliate Referrals API

FirstPromoter Affiliate Referrals API - 5 operation(s) on the promoter-facing (api/v2/affiliate) surface, from FirstPromoter's own published OpenAPI definition (3.0.1) indexed in https://docs.firstpromoter.com/llms.txt.

OpenAPI Specification

firstpromoter-v2-affiliate-referrals-openapi.yml Raw ↑
openapi: 3.0.1
info:
  title: FirstPromoter API
  version: '1.0'
  description: API documentation for FirstPromoter affiliate referrals
servers:
- url: https://api.firstpromoter.com/api/v2/affiliate
security:
- BearerAuth: []
paths:
  /referrals:
    get:
      summary: Get available referrals
      operationId: getReferrals
      parameters:
      - $ref: '#/components/parameters/AccountId'
      - name: q
        in: query
        description: Search params. Searches by email, uid, username, website
        required: false
        schema:
          type: string
      - name: filters[type]
        in: query
        description: Type (lead or customer)
        required: false
        schema:
          type: string
          enum:
          - lead
          - customer
      - name: filters[state]
        in: query
        description: State
        required: false
        schema:
          type: string
          enum:
          - subscribed
          - signup
          - active
          - cancelled
          - refunded
          - denied
          - pending
          - moved
      - name: filters[created_at][from]
        in: query
        description: created_at start date
        required: false
        schema:
          type: string
          format: date
      - name: filters[created_at][to]
        in: query
        description: created_at end date
        required: false
        schema:
          type: string
          format: date
      - name: filters[customer_since][from]
        in: query
        description: customer_since start date
        required: false
        schema:
          type: string
          format: date
      - name: filters[customer_since][to]
        in: query
        description: customer_since end date
        required: false
        schema:
          type: string
          format: date
      - name: filters[campaign_id]
        in: query
        description: Campaign ids. Can be Integer or an Array of Integers
        required: false
        schema:
          oneOf:
          - type: integer
          - type: array
            items:
              type: integer
      - name: sorting[state]
        in: query
        description: Sort by state direction
        required: false
        schema:
          type: string
          enum:
          - asc
          - desc
      - name: sorting[email]
        in: query
        description: Sort by email direction
        required: false
        schema:
          type: string
          enum:
          - asc
          - desc
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Referral'
        '401':
          description: Unauthorized
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
    post:
      summary: Create referral
      operationId: createReferral
      parameters:
      - $ref: '#/components/parameters/AccountId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - email
              - promoter_campaign_id
              properties:
                email:
                  type: string
                  format: email
                  description: Email of the referral
                promoter_campaign_id:
                  type: integer
                  description: The ID of the promoter campaign
                uid:
                  type: string
                  description: Unique ID of the referral
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Referral'
        '401':
          description: Unauthorized
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /referrals/{id}:
    put:
      summary: Update referral
      operationId: updateReferral
      parameters:
      - $ref: '#/components/parameters/AccountId'
      - name: id
        in: path
        required: true
        schema:
          type: integer
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                email:
                  type: string
                  format: email
                  description: Email of the referral
                uid:
                  type: string
                  description: Unique ID of the referral
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Referral'
        '401':
          description: Unauthorized
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
    delete:
      summary: Delete referral
      operationId: deleteReferral
      parameters:
      - $ref: '#/components/parameters/AccountId'
      - name: id
        in: path
        required: true
        schema:
          type: integer
      responses:
        '204':
          description: Successfully deleted
        '401':
          description: Unauthorized
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /referrals/export:
    get:
      summary: Export referrals
      operationId: exportReferrals
      parameters:
      - $ref: '#/components/parameters/AccountId'
      - name: filters[type]
        in: query
        description: Type (lead or customer)
        required: false
        schema:
          type: string
          enum:
          - lead
          - customer
      - name: filters[state]
        in: query
        description: State
        required: false
        schema:
          type: string
          enum:
          - subscribed
          - signup
          - active
          - cancelled
          - refunded
          - denied
          - pending
          - moved
      responses:
        '200':
          description: Successful response
          content:
            text/csv:
              schema:
                type: string
        '202':
          description: Export is being processed
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
        '401':
          description: Unauthorized
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  parameters:
    AccountId:
      name: Account-ID
      in: header
      required: true
      description: Account identifier that specifies which account is making the request
      schema:
        type: string
        example: acc_123456
  schemas:
    Referral:
      type: object
      properties:
        id:
          type: integer
        uid:
          type: string
        state:
          type: string
          enum:
          - subscribed
          - signup
          - active
          - cancelled
          - refunded
          - denied
          - pending
          - moved
        metadata:
          type: object
        created_at:
          type: string
          format: date-time
        customer_since:
          type: string
          format: date-time
        email:
          type: string
          format: email
        promoter_campaign:
          $ref: '#/components/schemas/PromoterCampaign'
    PromoterCampaign:
      type: object
      properties:
        id:
          type: integer
        campaign_id:
          type: integer
        created_at:
          type: string
          format: date-time
        campaign:
          $ref: '#/components/schemas/Campaign'
    Campaign:
      type: object
      properties:
        id:
          type: integer
        name:
          type: string
        color:
          type: string
    Error:
      type: object
      properties:
        message:
          type: string
        code:
          type: string
        errors:
          type: object
          additionalProperties:
            type: array
            items:
              type: string
      required:
      - message
      - code
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: Access token passed as a Bearer token in the Authorization header