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

# Create Invite

> Mint a join link or code for a chosen scope, org-scoped to the API key's org.

Scopes: `organization` (recruit a tutor/admin by email, or get a reusable org
join link), `tutor_student` (1-on-1), `classroom`, `group`, `parent`. Supply
`email` to invite a specific person (creates an invite row; EquateIt emails them
where the platform already does); omit `email` for a reusable shareable
link/code. Cross-org targets return 404. Honours `Idempotency-Key`.



## OpenAPI

````yaml /openapi.json post /v1/invites
openapi: 3.1.0
info:
  title: EquateIt Public API
  description: >-
    REST API for EquateIt tutoring organisations. Pipe your sessions, invoices,
    payments, tutor earnings, students, and more into your own tools. Most
    endpoints are reads; a focused set of writes (each gated by a *:write scope)
    create or update data, including creating student/tutor/parent accounts.


    Authenticate every request with an org API key:

        Authorization: Token token=ei_live_...

    Mint keys in the EquateIt app under Settings → Developers.
  version: 1.0.0
servers: []
security:
  - ApiKeyAuth: []
tags:
  - name: General
  - name: Sessions
  - name: Tutors
  - name: Students & Parents
  - name: Billing
  - name: Curriculum
  - name: Coursework
  - name: Operations
  - name: Pricing
  - name: Bookings
  - name: Blog
  - name: Reports
paths:
  /v1/invites:
    post:
      tags:
        - General
      summary: Create Invite
      description: >-
        Mint a join link or code for a chosen scope, org-scoped to the API key's
        org.


        Scopes: `organization` (recruit a tutor/admin by email, or get a
        reusable org

        join link), `tutor_student` (1-on-1), `classroom`, `group`, `parent`.
        Supply

        `email` to invite a specific person (creates an invite row; EquateIt
        emails them

        where the platform already does); omit `email` for a reusable shareable

        link/code. Cross-org targets return 404. Honours `Idempotency-Key`.
      operationId: create_invite_v1_invites_post
      parameters:
        - name: Idempotency-Key
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Idempotency-Key
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/InviteCreate'
      responses:
        '201':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Invite'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    InviteCreate:
      properties:
        scope:
          type: string
          enum:
            - organization
            - classroom
            - group
            - tutor_student
            - parent
          title: Scope
        role:
          anyOf:
            - type: string
            - type: 'null'
          title: Role
          description: 'organization only: ''tutor'' (default) | ''admin'' | ''student''.'
        email:
          anyOf:
            - type: string
            - type: 'null'
          title: Email
          description: Required for the organization email path; optional elsewhere.
        tutor_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Tutor Id
          description: Required for scope=tutor_student.
        classroom_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Classroom Id
          description: Required for scope=classroom.
        group_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Group Id
          description: Required for scope=group.
        student_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Student Id
          description: Required for scope=parent (the child).
        subject_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Subject Id
          description: Optional, scope=tutor_student only — echoed back + audited.
      additionalProperties: false
      type: object
      required:
        - scope
      title: InviteCreate
      description: >-
        POST /v1/invites → mint a join link or code for a chosen scope.


        Delivery is decided by `email` + `scope` (there is no `send_email`
        flag): supply

        `email` to invite a specific person — this creates an invite row and
        EquateIt

        emails them where the platform already does (`organization` always, via
        a DB

        trigger; `tutor_student` when an email is given). Omit `email` to get a
        reusable

        shareable link/code. Per-scope required/irrelevant fields are validated

        server-side (422). `organization_id`, tokens, and timestamps are always

        server-set; the invite RPCs are never called (they are
        auth.uid()-gated).
    Invite:
      properties:
        id:
          anyOf:
            - type: string
            - type: 'null'
          title: Id
        scope:
          type: string
          title: Scope
        role:
          anyOf:
            - type: string
            - type: 'null'
          title: Role
        target_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Target Id
        email:
          anyOf:
            - type: string
            - type: 'null'
          title: Email
        token:
          anyOf:
            - type: string
            - type: 'null'
          title: Token
        join_url:
          anyOf:
            - type: string
            - type: 'null'
          title: Join Url
        expires_at:
          anyOf:
            - type: string
            - type: 'null'
          title: Expires At
        subject_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Subject Id
        emailed:
          type: boolean
          title: Emailed
          default: false
        created_at:
          anyOf:
            - type: string
            - type: 'null'
          title: Created At
      type: object
      required:
        - scope
      title: Invite
      description: >-
        A minted invite. `token` carries the invite token
        (organization/tutor_student)

        or the code (parent / org-join-code scopes). `join_url` is null for
        `parent` (the

        code is entered manually). `emailed` is true only when EquateIt actually
        sent an

        email (organization, or tutor_student with an email).
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: Authorization
      description: Org API key as `Token token=ei_live_...`

````