> ## 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.

# Edit Personal API Key

> Edit active key metadata, operation scopes, or grant snapshots with version checking.

The signed-in owner must supply `expected_grant_version`. Widening scopes/projects, rebinding changed memberships, or extending expiration requires current-password confirmation. Narrowing access does not. A concurrent edit requires refreshing and reviewing the saved record; expired or revoked keys cannot be reactivated.


## OpenAPI

````yaml api-reference/openapi.json PATCH /v1/users/me/api-keys/{id}
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/{id}:
    parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
          format: uuid
    patch:
      tags:
        - Personal Key Management
      summary: Replace personal scopes/grants or update key metadata
      description: >-
        Signed-in owner session only. A personal key cannot edit its own
        scopes/grants. Expired or revoked keys cannot be reactivated. Scopes and
        grants replace their respective sets. Adding access, rebinding
        membership, or extending expiry requires current_password.
        expected_grant_version guards all edits. All-current resolves current
        IDs at submission time. Future access is never implicit.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdatePersonalKey'
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: integer
                  data:
                    $ref: '#/components/schemas/PersonalKeyManagementRecord'
                  metadata:
                    $ref: '#/components/schemas/PaginationMetadata'
                required:
                  - data
                additionalProperties:
                  $ref: '#/components/schemas/JsonValue'
        '403':
          description: Owner/password/access check failed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: >-
            Grant version changed, or key is inactive; refresh the record and
            review.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - ownerSession: []
      servers:
        - url: https://w-api.sendrealm.com
components:
  schemas:
    UpdatePersonalKey:
      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
        expected_grant_version:
          type: integer
          minimum: 0
          description: >-
            Optimistic concurrency token from the latest management record.
            Re-read after 409.
      required:
        - expected_grant_version
      additionalProperties: false
    PersonalKeyManagementRecord:
      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
      required:
        - id
        - name
        - preview
        - scopes
        - grants
        - grant_version
      additionalProperties:
        $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
    JsonValue:
      oneOf:
        - type: string
          nullable: true
        - type: number
        - type: boolean
        - type: object
          additionalProperties:
            $ref: '#/components/schemas/JsonValue'
        - type: array
          items:
            $ref: '#/components/schemas/JsonValue'
    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'
    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
    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
  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.