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

# Register new user

> Register a new user.



## OpenAPI

````yaml /openapi/user.yaml post /api/v1/auth/register
openapi: 3.0.3
info:
  title: CapeMedia User Service API
  version: 1.0.0
  description: |2-

        **CapeMedia User Service API** - Comprehensive user service and management system.

        ## Authentication
        This API uses **JWT Bearer tokens** for authentication.

        1. Login via `/api/v1/auth/login` to obtain tokens
        2. Include the access token in the `Authorization` header: `Bearer <access_token>`
        3. Refresh expired tokens via `/api/v1/auth/refresh-token`

        ## Versioning
        The API uses URL path versioning (e.g., `/api/v1/`, `/api/v2/`).
        Current version: **v1**
        
  contact:
    name: API Support
    email: support@capemedia.co.ke
  license:
    name: Cape Media
servers:
  - url: https://api.diginacape.co.ke/acl
    description: Production
  - url: http://localhost:8000
    description: Local
security: []
paths:
  /api/v1/auth/register:
    post:
      tags:
        - Registration
      summary: Register new user
      description: Register a new user.
      operationId: auth_register
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RegistrationRequest'
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/RegistrationRequest'
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/RegistrationRequest'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Registration'
          description: ''
      security:
        - bearerAuth: []
components:
  schemas:
    RegistrationRequest:
      type: object
      description: |-
        Serializer for user registration.

        Creates User + UserProfile in Django, then syncs to Keycloak.
      properties:
        email:
          type: string
          format: email
          minLength: 1
        first_name:
          type: string
          minLength: 1
          maxLength: 150
        last_name:
          type: string
          minLength: 1
          maxLength: 150
        country_code:
          type: string
          minLength: 1
          maxLength: 3
        phone_number:
          type: string
          minLength: 1
          maxLength: 50
        employee_number:
          type: string
          minLength: 1
          maxLength: 100
        department:
          type: string
          format: uuid
          nullable: true
        section:
          type: string
          format: uuid
          nullable: true
        roles:
          type: array
          items:
            type: string
            minLength: 1
        gender:
          enum:
            - MALE
            - FEMALE
          type: string
          description: |-
            * `MALE` - Male
            * `FEMALE` - Female
          x-spec-enum-id: 5ebfc1ecb69afaf0
        realm:
          type: string
          minLength: 1
          default: capemedia
      required:
        - country_code
        - email
        - employee_number
        - first_name
        - gender
        - last_name
        - phone_number
    Registration:
      type: object
      description: |-
        Serializer for user registration.

        Creates User + UserProfile in Django, then syncs to Keycloak.
      properties:
        email:
          type: string
          format: email
        first_name:
          type: string
          maxLength: 150
        last_name:
          type: string
          maxLength: 150
        country_code:
          type: string
          maxLength: 3
        phone_number:
          type: string
          maxLength: 50
        employee_number:
          type: string
          maxLength: 100
        department:
          type: string
          format: uuid
          nullable: true
        section:
          type: string
          format: uuid
          nullable: true
        roles:
          type: array
          items:
            type: string
        gender:
          enum:
            - MALE
            - FEMALE
          type: string
          description: |-
            * `MALE` - Male
            * `FEMALE` - Female
          x-spec-enum-id: 5ebfc1ecb69afaf0
        realm:
          type: string
          default: capemedia
      required:
        - country_code
        - email
        - employee_number
        - first_name
        - gender
        - last_name
        - phone_number
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: 'Enter your JWT token in the format: Bearer <token>'

````