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

# Update an API key

> Updates mutable fields on an API key in place — `label`, `default_tier`, and the four permission maps (`type_permissions`, `extension_permissions`, `edge_permissions`, `metadata_permissions`). `source` and `role` are immutable after creation and rejected with `400 validation_error` if present in the body — to change them, revoke and recreate. Admin or tenant_admin only.



## OpenAPI

````yaml /openapi.json patch /keys/{id}
openapi: 3.1.0
info:
  title: Marfa API
  version: 4.2.0
  description: Typed data layer for structured personal data
servers: []
security: []
paths:
  /keys/{id}:
    patch:
      tags:
        - Keys
      summary: Update an API key
      description: >-
        Updates mutable fields on an API key in place — `label`, `default_tier`,
        and the four permission maps (`type_permissions`,
        `extension_permissions`, `edge_permissions`, `metadata_permissions`).
        `source` and `role` are immutable after creation and rejected with `400
        validation_error` if present in the body — to change them, revoke and
        recreate. Admin or tenant_admin only.
      parameters:
        - schema:
            type: string
          required: true
          name: id
          in: path
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                label:
                  type: string
                  minLength: 1
                default_tier:
                  type: string
                  enum:
                    - library
                    - feed
                type_permissions:
                  type: object
                  additionalProperties:
                    type: string
                    enum:
                      - read
                      - write
                      - none
                extension_permissions:
                  type: object
                  additionalProperties:
                    type: string
                    enum:
                      - read
                      - write
                edge_permissions:
                  type: object
                  additionalProperties:
                    type: string
                    enum:
                      - read
                      - write
                metadata_permissions:
                  type: object
                  additionalProperties:
                    type: string
                    enum:
                      - read
                      - write
                source:
                  nullable: true
                role:
                  nullable: true
      responses:
        '200':
          description: Key updated
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                  label:
                    type: string
                  source:
                    type: string
                  role:
                    type: string
                    enum:
                      - admin
                      - tenant_admin
                      - member
                  default_tier:
                    type: string
                    enum:
                      - library
                      - feed
                  is_platform:
                    type: boolean
                  type_permissions:
                    type: object
                    additionalProperties:
                      type: string
                      enum:
                        - read
                        - write
                        - none
                  extension_permissions:
                    type: object
                    additionalProperties:
                      type: string
                      enum:
                        - read
                        - write
                  edge_permissions:
                    type: object
                    additionalProperties:
                      type: string
                      enum:
                        - read
                        - write
                  metadata_permissions:
                    type: object
                    additionalProperties:
                      type: string
                      enum:
                        - read
                        - write
                  created_at:
                    type: string
                  last_used_at:
                    type: string
                    nullable: true
                required:
                  - id
                  - label
                  - source
                  - role
                  - default_tier
                  - is_platform
                  - type_permissions
                  - created_at
                  - last_used_at
        '400':
          description: Invalid update (e.g. attempt to mutate an immutable field)
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                        enum:
                          - validation_error
                          - missing_required_field
                      message:
                        type: string
                      details:
                        type: object
                        additionalProperties:
                          nullable: true
                    required:
                      - code
                      - message
                required:
                  - error
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                        enum:
                          - unauthorized
                      message:
                        type: string
                      details:
                        type: object
                        additionalProperties:
                          nullable: true
                    required:
                      - code
                      - message
                required:
                  - error
        '403':
          description: Admin only
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                        enum:
                          - forbidden
                      message:
                        type: string
                      details:
                        type: object
                        additionalProperties:
                          nullable: true
                    required:
                      - code
                      - message
                required:
                  - error
        '404':
          description: Key not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                        enum:
                          - api_key_not_found
                      message:
                        type: string
                      details:
                        type: object
                        additionalProperties:
                          nullable: true
                    required:
                      - code
                      - message
                required:
                  - error
      security:
        - bearerAuth: []
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key or OAuth Token
      description: Pass an API key (marfa_k1_...) or OAuth access token (marfa_at_...)

````