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

# Imports or updates loyalty cards

> This endpoint will handle adding new loyalty cards or updating existing ones based on the provided data.



## OpenAPI

````yaml openapi/member-v1.json POST /v1/loyalty-cards/import
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/import:
    post:
      tags:
        - Service2Service
      summary: Imports or updates loyalty cards
      description: >-
        This endpoint will handle adding new loyalty cards or updating existing
        ones based on the provided data.
      requestBody:
        description: Collection of loyalty cards to import or update
        content:
          application/json:
            schema:
              maxItems: 1000
              minItems: 1
              type: array
              items:
                $ref: >-
                  #/components/schemas/MemberService.Api.CQRS.Models.UpsertLoyaltyCardRequest
          text/json:
            schema:
              maxItems: 1000
              minItems: 1
              type: array
              items:
                $ref: >-
                  #/components/schemas/MemberService.Api.CQRS.Models.UpsertLoyaltyCardRequest
          application/*+json:
            schema:
              maxItems: 1000
              minItems: 1
              type: array
              items:
                $ref: >-
                  #/components/schemas/MemberService.Api.CQRS.Models.UpsertLoyaltyCardRequest
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/MemberService.Api.CQRS.Models.UpsertLoyaltyCardsResult
        '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.CQRS.Models.UpsertLoyaltyCardRequest:
      required:
        - cardId
        - createdAt
        - memberId
        - state
        - type
      type: object
      properties:
        cardId:
          maxLength: 36
          minLength: 1
          type: string
          description: Loyalty card ID
        memberId:
          maxLength: 36
          minLength: 1
          type: string
          description: Member ID who owns the card
        state:
          $ref: '#/components/schemas/MemberService.Domain.Entities.LoyaltyCardState'
        type:
          $ref: '#/components/schemas/MemberService.Domain.Entities.LoyaltyCardType'
        createdAt:
          type: string
          description: Date and time when the card was created
          format: date-time
        cardHolderType:
          maxLength: 32
          type: string
          description: Type of cardholder (e.g., Member, Employee)
          nullable: true
      additionalProperties: false
    MemberService.Api.CQRS.Models.UpsertLoyaltyCardsResult:
      type: object
      properties:
        importedCardsCount:
          type: integer
          format: int32
        updatedCardsCount:
          type: integer
          format: int32
      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.LoyaltyCardState:
      enum:
        - Inactive
        - Active
      type: string
    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

````