REST /api/v1/referral-codes 6 endpoints
GET /api/v1/referral-codes/api/v1/referral-codes

List all referral codes

Public

Response Example

{
  "data": [
    {
      "id": "rc_8f3a21bc",
      "mentor_id": "usr_4491",
      "org_id": "org_002",
      "code": "JAN-VERV-8F3A",
      "url": "https://app.org.no/join?ref=JAN-VERV-8F3A",
      "status": "active",
      "created_at": "2026-01-10T09:00:00Z",
      "expires_at": null
    }
  ],
  "pagination": {
    "page": 1,
    "limit": 20,
    "total": 47
  }
}
GET /api/v1/referral-codes/api/v1/referral-codes/:id

Get referral code by ID

Public

Response Example

{
  "id": "rc_8f3a21bc",
  "mentor_id": "usr_4491",
  "org_id": "org_002",
  "code": "JAN-VERV-8F3A",
  "url": "https://app.org.no/join?ref=JAN-VERV-8F3A",
  "status": "active",
  "created_at": "2026-01-10T09:00:00Z",
  "expires_at": null
}
POST /api/v1/referral-codes/api/v1/referral-codes

Get or create referral code for a mentor (getOrCreateReferralCode)

Public

Request Example

{
  "mentor_id": "usr_4491",
  "org_id": "org_002"
}

Response Example

{
  "id": "rc_8f3a21bc",
  "mentor_id": "usr_4491",
  "org_id": "org_002",
  "code": "JAN-VERV-8F3A",
  "url": "https://app.org.no/join?ref=JAN-VERV-8F3A",
  "status": "active",
  "created_at": "2026-01-10T09:00:00Z",
  "expires_at": null
}
PUT /api/v1/referral-codes/api/v1/referral-codes/:id

Rotate referral code (rotateCode)

Public

Request Example

{
  "mentor_id": "usr_4491",
  "action": "rotate"
}

Response Example

{
  "id": "rc_9c4b32de",
  "mentor_id": "usr_4491",
  "org_id": "org_002",
  "code": "JAN-VERV-9C4B",
  "url": "https://app.org.no/join?ref=JAN-VERV-9C4B",
  "status": "active",
  "previous_code": "JAN-VERV-8F3A",
  "rotated_at": "2026-03-26T11:30:00Z",
  "created_at": "2026-03-26T11:30:00Z",
  "expires_at": null
}
DELETE /api/v1/referral-codes/api/v1/referral-codes/:id

Invalidate referral code (invalidateCode)

Public

Response Example

{
  "id": "rc_8f3a21bc",
  "status": "invalidated",
  "invalidated_at": "2026-03-26T12:00:00Z"
}
GET /api/v1/referral-codes/api/v1/referral-codes/:id/url

Build referral URL for a code (buildReferralUrl)

Public

Response Example

{
  "code": "JAN-VERV-8F3A",
  "url": "https://app.org.no/join?ref=JAN-VERV-8F3A",
  "short_url": "https://org.no/r/JAN-VERV-8F3A",
  "generated_at": "2026-03-26T11:00:00Z"
}

Additional Metadata

{
  "contract_summary": {
    "total_contracts": 410,
    "total_endpoints": 2416,
    "api_styles_used": [
      "rest"
    ]
  },
  "generated_at": "2026-03-26T06:55:53.316Z"
}