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

# Mint Api Key

> Mint a new API key for the team.

Returns the full plaintext `secret` in `data.attributes.secret`.
This is the ONLY time the secret is returned — store it immediately.

Managing keys requires a real user (JWT) session — a key cannot mint keys.



## OpenAPI

````yaml /openapi/mio-openapi.json post /api/v1/teams/{team_id}/api-keys
openapi: 3.1.0
info:
  description: >-
    Production API reference for Membership.io. Use the authored guides for
    workflows and the generated endpoint pages for exact parameters and schemas.
  title: Membership.io API
  version: 0.1.0
servers:
  - description: Production
    url: https://api.member.dev
security:
  - bearerAuth: []
paths:
  /api/v1/teams/{team_id}/api-keys:
    post:
      tags:
        - api-keys
      summary: Mint Api Key
      description: >-
        Mint a new API key for the team.


        Returns the full plaintext `secret` in `data.attributes.secret`.

        This is the ONLY time the secret is returned — store it immediately.


        Managing keys requires a real user (JWT) session — a key cannot mint
        keys.
      operationId: api_keys.post_api_keys_post_teams_by_team_id_api_keys
      parameters:
        - in: path
          name: team_id
          required: true
          schema:
            title: Team Id
            type: string
      requestBody:
        content:
          application/vnd.api+json:
            schema:
              $ref: '#/components/schemas/ApiKeyCreateRequest'
        required: true
      responses:
        '201':
          content:
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/JsonApiResponse_ApiKeyCreateAttributes_'
          description: Successful Response
        '422':
          content:
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
          description: Validation Error
      security:
        - HTTPBearer: []
components:
  schemas:
    ApiKeyCreateRequest:
      properties:
        can_moderate:
          default: false
          title: Can Moderate
          type: boolean
        expires_at:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          title: Expires At
        name:
          title: Name
          type: string
        scopes:
          default:
            - '*'
          items:
            type: string
          title: Scopes
          type: array
      required:
        - name
      title: ApiKeyCreateRequest
      type: object
    JsonApiResponse_ApiKeyCreateAttributes_:
      properties:
        data:
          $ref: '#/components/schemas/JsonApiResource_ApiKeyCreateAttributes_'
        included:
          anyOf:
            - items: {}
              type: array
            - type: 'null'
          title: Included
        links:
          anyOf:
            - $ref: '#/components/schemas/JsonApiLinks'
            - type: 'null'
        meta:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Meta
      required:
        - data
      title: JsonApiResponse[ApiKeyCreateAttributes]
      type: object
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          title: Detail
          type: array
      title: HTTPValidationError
      type: object
    JsonApiResource_ApiKeyCreateAttributes_:
      properties:
        attributes:
          $ref: '#/components/schemas/ApiKeyCreateAttributes'
        id:
          title: Id
          type: string
        links:
          anyOf:
            - $ref: '#/components/schemas/JsonApiLinks'
            - type: 'null'
        meta:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Meta
        relationships:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Relationships
        type:
          title: Type
          type: string
      required:
        - id
        - type
        - attributes
      title: JsonApiResource[ApiKeyCreateAttributes]
      type: object
    JsonApiLinks:
      properties:
        self:
          anyOf:
            - type: string
            - type: 'null'
          title: Self
      title: JsonApiLinks
      type: object
    ValidationError:
      properties:
        ctx:
          title: Context
          type: object
        input:
          title: Input
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          title: Location
          type: array
        msg:
          title: Message
          type: string
        type:
          title: Error Type
          type: string
      required:
        - loc
        - msg
        - type
      title: ValidationError
      type: object
    ApiKeyCreateAttributes:
      description: >-
        Attributes returned ONLY on the 201 create response.


        Includes `secret` — the full plaintext key, returned once and never
        again.
      properties:
        can_moderate:
          default: false
          title: Can Moderate
          type: boolean
        created_at:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          title: Created At
        created_by:
          title: Created By
          type: string
        expires_at:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          title: Expires At
        key_prefix:
          title: Key Prefix
          type: string
        last_used_at:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          title: Last Used At
        name:
          title: Name
          type: string
        revoked_at:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          title: Revoked At
        scopes:
          items:
            type: string
          title: Scopes
          type: array
        secret:
          title: Secret
          type: string
        updated_at:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          title: Updated At
      required:
        - name
        - key_prefix
        - scopes
        - secret
        - created_by
      title: ApiKeyCreateAttributes
      type: object
  securitySchemes:
    bearerAuth:
      bearerFormat: JWT or mio_sk API key
      description: >-
        Send platform JWTs, contact JWTs, or team API keys as `Authorization:
        Bearer <token>`.
      scheme: bearer
      type: http
    HTTPBearer:
      scheme: bearer
      type: http

````