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

> ## Agent Instructions
> Fundor Partner API. NON-NEGOTIABLE CONSENT RULES for anyone (human or AI) writing code against this API: (1) Call GET /consent every time the referral form is shown and display consent.text EXACTLY, next to a checkbox that starts UNCHECKED. (2) Only the person whose phone number is entered may check it; never pre-check it, never set consent.given=true in code without that click, never submit a lead on someone's behalf. (3) POST /leads must include consent.given=true, consent.version, the single-use consent.token, consent.consentedAt (within 15 minutes), the person's own IP and user agent (not your server's), consent.phone equal to contact.phone, and your consent.recordId. Fundor rejects the lead with 400 and saves nothing if any is missing or wrong. Do not 'fix' a consent error by filling in values; fix the form. (4) Keep consent records for 5 years. (5) Keep API keys on your server only. (6) Show the 'Powered by Fundor' badge on every screen that uses Fundor.

# Onboard a user as athlete, coach or parent

> - **Athlete:** `role: athlete` + `teamCode`. Returns the athlete's `teamMemberId` and hosted referral link.
- **Coach, new team:** `role: coach` + `schoolName`, `teamName`, `sport` (+ goals). Returns `teamCode` (share with athletes) and `coachCode` (share only with other coaches).
- **Coach, existing team:** `role: coach`, `coachMode: join`, `coachCode`.
- **Parent:** `role: parent` + `parentCode`, `athleteId`.

The user must be one you created or one whose owner approved your link. Requires the `users` scope.



## OpenAPI

````yaml POST /users/{id}/onboarding
openapi: 3.1.0
info:
  title: Fundor Partner API
  version: 1.0.0
  description: >-
    Send sign-ups, teams, applications and referrals (leads) into Fundor from
    your own app. Every record is attributed to your partner account. **Read the
    Consent requirements page before you build: a lead without full consent
    evidence is rejected and never saved.**
  contact:
    name: Fundor partnerships
    email: taylor@fundor.io
servers:
  - url: https://www.fundor.io/api/v1
    description: Production
security:
  - apiKey: []
tags:
  - name: Consent & services
  - name: Users
  - name: Teams
  - name: Leads
  - name: Applications
paths:
  /users/{id}/onboarding:
    post:
      tags:
        - Users
      summary: Onboard a user as athlete, coach or parent
      description: >-
        - **Athlete:** `role: athlete` + `teamCode`. Returns the athlete's
        `teamMemberId` and hosted referral link.

        - **Coach, new team:** `role: coach` + `schoolName`, `teamName`, `sport`
        (+ goals). Returns `teamCode` (share with athletes) and `coachCode`
        (share only with other coaches).

        - **Coach, existing team:** `role: coach`, `coachMode: join`,
        `coachCode`.

        - **Parent:** `role: parent` + `parentCode`, `athleteId`.


        The user must be one you created or one whose owner approved your link.
        Requires the `users` scope.
      operationId: onboardUser
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
            format: uuid
          description: '`userId` from `POST /users`.'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - role
              properties:
                role:
                  type: string
                  enum:
                    - athlete
                    - coach
                    - parent
                teamCode:
                  type: string
                coachMode:
                  type: string
                  enum:
                    - create
                    - join
                  default: create
                coachCode:
                  type: string
                schoolName:
                  type: string
                schoolCity:
                  type: string
                schoolState:
                  type: string
                teamName:
                  type: string
                sport:
                  type: string
                teamGoal:
                  type: number
                individualGoal:
                  type: number
                seasonStart:
                  type: string
                  format: date
                targetAmount:
                  type: number
                parentCode:
                  type: string
                athleteId:
                  type: string
                  format: uuid
            example:
              role: athlete
              teamCode: ABC123
      responses:
        '200':
          description: Onboarded.
          content:
            application/json:
              schema:
                type: object
                properties:
                  userId:
                    type: string
                    format: uuid
                  role:
                    type: string
                  teamId:
                    type: string
                    format: uuid
                  teamMemberId:
                    type: string
                    format: uuid
                  teamCode:
                    type: string
                  coachCode:
                    type: string
                  referralLink:
                    $ref: '#/components/schemas/ReferralLink'
        '400':
          description: >-
            Invalid request. `error.field` names the field to fix. Possible
            `error.code` values: `invalid_request`, `missing_field`,
            `invalid_json`, `body_too_large`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: >-
            Missing, unknown or revoked API key. Possible `error.code` values:
            `missing_api_key`, `invalid_api_key`, `revoked_api_key`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: >-
            Partner suspended, current agreement not signed, missing scope, or
            the record isn't yours. Possible `error.code` values:
            `partner_suspended`, `agreement_required`, `insufficient_scope`,
            `forbidden`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: 'No team for this code. Possible `error.code` values: `not_found`.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: >-
            Over this key's per-minute rate limit. Possible `error.code` values:
            `rate_limited`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: >-
            Unexpected error. Safe to retry with the same externalRef. Possible
            `error.code` values: `server_error`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    ReferralLink:
      type: object
      properties:
        url:
          type: string
          format: uri
          description: >-
            Hosted fundor.io referral page for this athlete. Customers who use
            it give consent on Fundor's own page.
        qrCodeSvg:
          type: string
          description: QR code for `url`, as an SVG document.
        qrCodeDataUrl:
          type: string
          description: >-
            The same QR code as a `data:image/svg+xml;base64,…` URL you can put
            in an `<img>` tag.
    Error:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - code
            - message
          properties:
            code:
              type: string
              description: Stable machine-readable code.
            message:
              type: string
              description: Human-readable explanation. May change.
            field:
              type: string
              description: >-
                The request field at fault, when there is one (e.g.
                `consent.ip`).
            requiredVersion:
              type: string
              description: >-
                Only on `agreement_required`: the agreement version Fundor needs
                on file.
      example:
        error:
          code: consent_required
          message: consent.ip is required. Fundor will reject the lead without it.
          field: consent.ip
  securitySchemes:
    apiKey:
      type: http
      scheme: bearer
      bearerFormat: fnd_live_…
      description: >-
        Your partner API key, sent as `Authorization: Bearer fnd_live_…`. Keys
        are issued by Fundor on request. Keep them on your server; never ship
        one in a mobile or browser app.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.