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

# Creates a new loyalty card



## OpenAPI

````yaml openapi/member-v1.json POST /v1/loyalty-cards
openapi: 3.0.4
info:
  title: MemberService.Api
  version: v1
servers:
  - url: https://{host}/member
    description: Your Lobyco environment
    variables:
      host:
        default: your-environment.lobyco.net
        description: >-
          The API host for your Lobyco environment. Replace it with the host you
          were given — this placeholder does not resolve.
security:
  - Bearer: []
paths:
  /v1/loyalty-cards:
    post:
      tags:
        - Service2Service
      summary: Creates a new loyalty card
      parameters:
        - name: replaceActive
          in: query
          description: >-
            If set to true, inactivates the member's active cards when creating
            a new one. 
                        Otherwise, the endpoint can return an error if the maximum number of active cards limit is reached.
          schema:
            type: boolean
            default: false
      requestBody:
        description: Loyalty card creation request
        content:
          application/json:
            schema:
              $ref: >-
                #/components/schemas/MemberService.Api.Controllers.DTOs.CreateLoyaltyCardRequest
          text/json:
            schema:
              $ref: >-
                #/components/schemas/MemberService.Api.Controllers.DTOs.CreateLoyaltyCardRequest
          application/*+json:
            schema:
              $ref: >-
                #/components/schemas/MemberService.Api.Controllers.DTOs.CreateLoyaltyCardRequest
        required: true
      responses:
        '200':
          description: OK
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/LoopFoundation.Commons.Contracts.WebServiceError
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/LoopFoundation.Commons.Contracts.WebServiceError
components:
  schemas:
    MemberService.Api.Controllers.DTOs.CreateLoyaltyCardRequest:
      required:
        - memberId
        - type
      type: object
      properties:
        cardId:
          maxLength: 36
          type: string
          description: Loyalty card ID
          nullable: true
        memberId:
          maxLength: 36
          minLength: 1
          type: string
          description: Member ID
        type:
          $ref: '#/components/schemas/MemberService.Domain.Entities.LoyaltyCardType'
        cardHolderType:
          maxLength: 32
          type: string
          description: Type of cardholder (e.g., Member, Employee)
          nullable: true
        operationId:
          maxLength: 128
          type: string
          description: >-
            Optional idempotency key to prevent duplicate card creation during
            retries or concurrent requests
          nullable: true
      additionalProperties: false
    LoopFoundation.Commons.Contracts.WebServiceError:
      required:
        - message
        - name
      type: object
      properties:
        name:
          minLength: 1
          type: string
        message:
          minLength: 1
          type: string
        details:
          nullable: true
      additionalProperties: false
    MemberService.Domain.Entities.LoyaltyCardType:
      enum:
        - Physical
        - Virtual
      type: string
  securitySchemes:
    Bearer:
      type: apiKey
      description: >-
        JWT Authorization header using the Bearer scheme. Example:
        "Authorization: Bearer {token}"
      name: Authorization
      in: header

````