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

# Create Personal API Key

> Create an expiring personal key with explicit scopes and current project grants.

This dashboard management endpoint requires the owner's signed-in session and current password. Supply explicit scopes plus selected team/project grants, or `select_all_current_teams: true` to save a snapshot. New projects and memberships are never granted automatically. The secret is returned once. Prefer one named key per client, the Read only preset, and a 90-day expiration.


## OpenAPI

````yaml api-reference/openapi.json POST /v1/users/me/api-keys
openapi: 3.0.1
info:
  title: Sendrealm API
  description: >-
    API for email, push, audience resources, domains, campaign drafts,
    templates, events, topics, and automations
  license:
    name: MIT
  version: 0.2.0
servers:
  - url: https://api.sendrealm.com
security:
  - bearerAuth: []
paths:
  /v1/users/me/api-keys:
    post:
      tags:
        - Personal Key Management
      summary: Create a scoped personal key
      description: >-
        Signed-in owner session only. A personal key cannot edit its own
        scopes/grants. Expired or revoked keys cannot be reactivated.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreatePersonalKey'
      responses:
        '201':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: integer
                  data:
                    type: object
                    properties:
                      id:
                        type: string
                        format: uuid
                      name:
                        type: string
                      preview:
                        type: string
                      scopes:
                        type: array
                        items:
                          $ref: '#/components/schemas/PersonalKeyScope'
                      grants:
                        type: array
                        items:
                          type: object
                          properties:
                            team_id:
                              type: string
                              format: uuid
                            team_name:
                              type: string
                              nullable: true
                            project_ids:
                              type: array
                              items:
                                type: string
                                format: uuid
                            projects:
                              type: array
                              items:
                                type: object
                                properties:
                                  id:
                                    type: string
                                    format: uuid
                                  name:
                                    type: string
                                    nullable: true
                                additionalProperties: false
                            membership_active:
                              type: boolean
                          required:
                            - team_id
                            - project_ids
                            - membership_active
                          additionalProperties:
                            $ref: '#/components/schemas/JsonValue'
                      grant_version:
                        type: integer
                      grants_initialized_at:
                        type: string
                        format: date-time
                        nullable: true
                      expires_at:
                        type: string
                        format: date-time
                        nullable: true
                      revoked_at:
                        type: string
                        format: date-time
                        nullable: true
                      last_used_at:
                        type: string
                        format: date-time
                        nullable: true
                      created_at:
                        type: string
                        format: date-time
                      key:
                        type: string
                        description: >-
                          One-time personal-key secret. Copy now; never
                          recoverable later.
                    required:
                      - id
                      - name
                      - preview
                      - scopes
                      - grants
                      - grant_version
                      - key
                    additionalProperties:
                      $ref: '#/components/schemas/JsonValue'
                  metadata:
                    $ref: '#/components/schemas/PaginationMetadata'
                required:
                  - data
                additionalProperties:
                  $ref: '#/components/schemas/JsonValue'
        '400':
          $ref: '#/components/responses/BadRequest'
        '403':
          description: Password confirmation failed or selected access is unavailable.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - ownerSession: []
      servers:
        - url: https://w-api.sendrealm.com
components:
  schemas:
    CreatePersonalKey:
      type: object
      properties:
        name:
          type: string
          minLength: 1
          maxLength: 120
        current_password:
          type: string
          description: >-
            Required when widening grants/scopes, rebinding memberships or
            extending expiry. Never logged.
        scopes:
          type: array
          items:
            $ref: '#/components/schemas/PersonalKeyScope'
        grants:
          type: array
          items:
            $ref: '#/components/schemas/PersonalKeyGrant'
        select_all_current_teams:
          type: boolean
          description: >-
            Resolve the owner's current eligible projects at submission and save
            their IDs; future access is excluded.
        expires_at:
          type: string
          format: date-time
          nullable: true
      required:
        - name
        - current_password
      additionalProperties: false
    PersonalKeyScope:
      type: string
      description: >-
        Explicit current MCP operation. All scopes is this saved list; future
        operations require an owner edit.
      enum:
        - resources.read
        - diagnostics.read
        - audiences.write
        - topics.write
        - campaigns.draft.write
        - automations.draft.write
        - automation_tests.write
        - automation_runs.manage
        - push_apps.write
        - push.test.send
        - events.ingest
        - automations.trigger
    JsonValue:
      oneOf:
        - type: string
          nullable: true
        - type: number
        - type: boolean
        - type: object
          additionalProperties:
            $ref: '#/components/schemas/JsonValue'
        - type: array
          items:
            $ref: '#/components/schemas/JsonValue'
    PaginationMetadata:
      type: object
      required:
        - total
        - items
        - limit
        - after
        - next
        - has_more
      properties:
        total:
          type: integer
        items:
          type: integer
        limit:
          type: integer
        after:
          type: string
          nullable: true
        next:
          type: string
          nullable: true
        has_more:
          type: boolean
    Error:
      type: object
      required:
        - status
        - error
      properties:
        status:
          type: integer
        error:
          type: object
          required:
            - code
            - message
          properties:
            code:
              type: string
            message:
              type: string
            details:
              $ref: '#/components/schemas/JsonValue'
            issues:
              type: array
              items:
                $ref: '#/components/schemas/ValidationIssue'
    PersonalKeyGrant:
      type: object
      properties:
        team_id:
          type: string
          format: uuid
        project_ids:
          type: array
          items:
            type: string
            format: uuid
      required:
        - team_id
        - project_ids
      additionalProperties: false
    ValidationIssue:
      type: object
      required:
        - code
        - path
        - message
      properties:
        code:
          type: string
        path:
          type: string
          nullable: true
        message:
          type: string
  responses:
    BadRequest:
      description: Bad request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        Integration key for backend workloads, or a scoped personal key
        (sr_user_) for account discovery and supported project operations. MCP
        accepts only personal keys.
    ownerSession:
      type: http
      scheme: bearer
      bearerFormat: Owner session token

````

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