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

# Create Referral

> Create or update a referral



## OpenAPI

````yaml post /referrals
openapi: 3.0.0
info:
  title: Flock API
  description: API Documentation for Flock
  version: '1.0'
  contact: {}
servers:
  - url: https://api-dev.withflock.com
security: []
tags: []
paths:
  /referrals:
    post:
      tags:
        - Referral
      description: Create or update a referral
      operationId: ReferralController_upsertReferral
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateReferralDTO'
      responses:
        '201':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ReferralResponseDTO'
      security:
        - accessKey: []
components:
  schemas:
    CreateReferralDTO:
      type: object
      properties:
        campaignId:
          type: string
        refereeId:
          type: string
          description: >-
            The ID of the customer being invited. Use this or
            refereeExternalUserId to identify the customer
        refereeExternalUserId:
          type: string
          description: >-
            The external ID of the customer being invited. Use this or refereeId
            to identify the customer
        referralCode:
          type: string
      required:
        - campaignId
        - referralCode
    ReferralResponseDTO:
      type: object
      properties:
        id:
          type: string
        campaignId:
          type: string
        refereeId:
          type: string
          nullable: true
        referrerId:
          type: string
        status:
          type: object
        suspectedFrauds:
          nullable: true
          type: array
          items:
            $ref: '#/components/schemas/FraudResultDTO'
        environment:
          type: string
          enum:
            - production
            - test
        organizationId:
          type: string
        applicationId:
          type: string
        createdAt:
          format: date-time
          type: string
        updatedAt:
          format: date-time
          type: string
        deletedAt:
          format: date-time
          type: string
          nullable: true
      required:
        - id
        - campaignId
        - refereeId
        - referrerId
        - status
        - suspectedFrauds
        - environment
        - organizationId
        - applicationId
        - createdAt
        - updatedAt
        - deletedAt
    FraudResultDTO:
      type: object
      properties:
        message:
          type: string
        type:
          type: string
      required:
        - message
        - type
  securitySchemes:
    accessKey:
      type: apiKey
      in: header
      name: Authorization

````