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

# Create CustomerCard

> Create a new card for a customer



## OpenAPI

````yaml openapi.yaml post /cards
openapi: 3.0.0
info:
  title: Open API
  version: v1
  contact:
    name: Sparkle
    email: support@sparkle.ng
    url: https://sparkle.ng
  description: >
    The Regulatory Framework for Open Banking in Nigeria established principles
    for data sharing across the banking and payments system to promote
    innovations and broaden the range of financial products and services
    available to bank customers. As a result, open banking recognizes the
    ownership and control of data by customers of financial and non-financial
    services, and their right to grant authorizations to service providers for
    the purpose of accessing innovative financial products and services.


    ## What this document is about

    This is a draft of the API specification standards designed to be used in
    compliance with the Central Bank of Nigeria (CBN) operational guidelines on
    open banking within the Nigerian financial ecosystem.


    ## Scope

    Given the open banking proposition, any organisation that has data of
    customers which may be exchanged with other entities for the purpose of
    providing innovative financial services within Nigeria, is eligible to
    participate in the Open Banking ecosystem.


    ## Authentication

    Authorization to API endpoints is performed using OAuth 2.0 Client
    Credentials flow.


    https://apis.openbanking.ng/#d9bd2beb-bb24-4ac3-95c4-7fc3d4f486c3
servers:
  - url: '{authUrl}'
    variables:
      authUrl:
        default: https://identity-sandbox.sparkle.fyi
        description: Authentication URL
  - url: '{apiUrl}'
    variables:
      apiUrl:
        default: https://api-sandbox.sparkle.fyi/openapi/v1
        description: Base URL for the API
security: []
tags:
  - name: DynamicClientRegistration
    description: Dynamic client registration endpoints
  - name: Consent
    description: Authentication and authorization endpoints
  - name: Meta
    description: Meta information endpoints
  - name: Health
    description: Health check endpoints
  - name: Customers
    description: Customer management endpoints
  - name: Accounts
    description: Account management endpoints
  - name: Transfers
    description: Transaction and transfer related endpoints
  - name: Bill Payments
    description: Bill payment related endpoints
  - name: Disputes
    description: Dispute management endpoints
  - name: Direct Debits
    description: Direct debit management endpoints
  - name: Cards
    description: Card management and transaction endpoints
  - name: Loans
    description: Loan management endpoints
  - name: Savings
    description: Savings management endpoints
paths:
  /cards:
    post:
      tags:
        - Cards
      summary: Create CustomerCard
      description: Create a new card for a customer
      operationId: createCard
      parameters:
        - name: connection-id
          in: header
          required: false
          schema:
            type: string
          description: Connection ID for the target bank
          example: CONN0987654321
        - name: idempotency-key
          in: header
          required: true
          schema:
            type: string
          description: Unique key to ensure idempotency of the request
          example: '1234567890987654321'
        - name: signature
          in: header
          required: true
          schema:
            type: string
          description: SHA-256 signature of client_secret + ";" + idempotency-key
          example: SHA-256({{YOUR_CLIENT_SECRET}} + ";" + idempotency-key)
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - card_status
                - account_number
                - card_holder_name
                - card_default_pin
                - card_expiry
              properties:
                product_id:
                  type: string
                  description: The unique identifier for the product
                  example: '1'
                card_type:
                  type: string
                  description: The type of the card
                  example: VIRTUAL
                  enum:
                    - VIRTUAL
                    - PHYSICAL
                    - OTHER
                card_mode:
                  type: string
                  description: The mode of the card
                  example: DEBIT
                  enum:
                    - DEBIT
                    - CREDIT
                    - PREPAID
                    - OTHER
                card_status:
                  type: string
                  description: The status of the card
                  example: ACTIVE
                  enum:
                    - ACTIVE
                    - INACTIVE
                    - BLOCKED
                    - LOST
                    - STOLEN
                card_currency:
                  type: string
                  description: The currency of the card
                  example: NGN
                  enum:
                    - NGN
                card_holder_name:
                  type: string
                  description: The name of the card holder
                  example: John Doe
                card_default_pin:
                  type: string
                  description: >-
                    The default PIN of the card, encrypted with the client
                    secret
                  example: '1234'
                card_expiry:
                  type: object
                  properties:
                    month:
                      type: string
                      description: The expiry month of the card
                      example: '01'
                    year:
                      type: string
                      description: The expiry year of the card
                      example: '2024'
                card_address:
                  type: object
                  properties:
                    street:
                      type: string
                      description: The street of the card
                      example: 123 Main St
                    city:
                      type: string
                      description: The city of the card
                      example: New York
                    state:
                      type: string
                      description: The state of the card
                      example: NY
                    country:
                      type: string
                      description: The country of the card
                      example: US
                custom_properties:
                  type: array
                  items:
                    type: object
                    properties:
                      id:
                        type: string
                        description: The unique identifier for the custom property
                        example: '1'
                      description:
                        type: string
                        description: The description of the custom property
                        example: custom_property
                      type:
                        type: string
                        description: The type of the custom property
                        example: string
                      value:
                        type: string
                        description: The value of the custom property
                        example: custom_property
      responses:
        '201':
          description: Card created successfully
          content:
            application/json:
              schema:
                type: object
                required:
                  - status
                  - message
                  - data
                properties:
                  status:
                    type: string
                    example: '00'
                  message:
                    type: string
                    example: Card created successfully
                  data:
                    type: object
                    required:
                      - card_id
                      - card_status
                    properties:
                      card_id:
                        type: string
                        description: The unique identifier for the card
                        example: '1'
                      customer_id:
                        type: string
                        description: The unique identifier for the customer
                        example: '1'
                      product_id:
                        type: string
                        description: The unique identifier for the product
                        example: '1'
                      account_number:
                        type: string
                        description: The account number of the card
                        example: '1234567890'
                      card_scheme:
                        type: string
                        description: The scheme of the card
                        example: VISA
                      card_type:
                        type: string
                        description: The type of the card
                        example: VIRTUAL
                        enum:
                          - VIRTUAL
                          - PHYSICAL
                          - OTHER
                      card_mode:
                        type: string
                        description: The mode of the card
                        example: DEBIT
                        enum:
                          - DEBIT
                          - CREDIT
                          - PREPAID
                          - OTHER
                      card_status:
                        type: string
                        description: The status of the card
                        example: ACTIVE
                        enum:
                          - ACTIVE
                          - INACTIVE
                          - BLOCKED
                          - LOST
                          - STOLEN
                      card_currency:
                        type: string
                        description: The currency of the card
                        example: NGN
                        enum:
                          - NGN
                      card_holder_name:
                        type: string
                        description: The name of the card holder
                        example: John Doe
                      card_number:
                        type: string
                        description: >-
                          The last 4 digits of the card number, encrypted with
                          the client secret
                        example: '1234'
                      card_cvv2:
                        type: string
                        description: The CVV2 of the card, encrypted with the client secret
                        example: '123'
                      card_default_pin:
                        type: string
                        description: >-
                          The default PIN of the card, encrypted with the client
                          secret
                        example: '1234'
                      card_token:
                        type: string
                        description: >-
                          The token of the card, encrypted with the client
                          secret
                        example: '1234567890'
                      card_expiry:
                        type: object
                        properties:
                          month:
                            type: string
                            description: The expiry month of the card
                            example: '01'
                          year:
                            type: string
                            description: The expiry year of the card
                            example: '2024'
                      card_address:
                        type: object
                        properties:
                          street:
                            type: string
                            description: The street of the card
                            example: 123 Main St
                          city:
                            type: string
                            description: The city of the card
                            example: New York
                          state:
                            type: string
                            description: The state of the card
                            example: NY
                          country:
                            type: string
                            description: The country of the card
                            example: US
                      custom_properties:
                        type: array
                        items:
                          type: object
                          properties:
                            id:
                              type: string
                              description: The unique identifier for the custom property
                              example: '1'
                            description:
                              type: string
                              description: The description of the custom property
                              example: custom_property
                            type:
                              type: string
                              description: The type of the custom property
                              example: string
                            value:
                              type: string
                              description: The value of the custom property
                              example: custom_property
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '500':
          $ref: '#/components/responses/InternalServerError'
      security:
        - oauth2:
            - cards.create
components:
  responses:
    BadRequest:
      description: Bad request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/BadRequestError'
    Unauthorized:
      description: Unauthorized request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/UnauthorizedError'
    Forbidden:
      description: Forbidden request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ForbiddenError'
    InternalServerError:
      description: Internal server error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/InternalServerError'
  schemas:
    BadRequestError:
      type: object
      properties:
        status:
          type: string
          description: The 8583 standard response code
          example: '01'
        error_code:
          type: string
          description: The specific Open Banking Nigeria error code
          example: MISSING_FIELD
        message:
          type: string
          description: A human-readable message describing the error
          example: The field is missing
        data:
          type: object
          description: Extra information about the error
    UnauthorizedError:
      type: object
      properties:
        status:
          type: string
          description: The 8583 standard response code
          example: '02'
        message:
          type: string
          description: A human-readable message describing the error
          example: The authentication failed
        data:
          type: object
          description: Extra information about the error
    ForbiddenError:
      type: object
      properties:
        status:
          type: string
          description: The 8583 standard response code
          example: '03'
        message:
          type: string
          description: A human-readable message describing the error
          example: You are not allowed to perform this operation
        data:
          type: object
          description: Extra information about the error
    InternalServerError:
      type: object
      properties:
        status:
          type: string
          description: The 8583 standard response code
          example: '05'
        message:
          type: string
          description: A human-readable message describing the error
          example: An unknown error occurred
        data:
          type: object
          description: Extra information about the error
  securitySchemes:
    oauth2:
      type: oauth2
      flows:
        clientCredentials:
          tokenUrl: /oauth2/token
          scopes:
            openid: Make an OpenID Connect request
            customers.readonly: View customers
            customers.update: Update a customer
            accounts.create: Create an account
            accounts.list.readonly: View accounts
            accounts.balance.readonly: View account balance
            accounts.update: Update an account
            accounts.transactions.readonly: View transactions
            accounts.holds.readonly: View holds
            accounts.holds.create: Create a hold
            accounts.holds.update: Update a hold
            transfers.transactions.enquiry: Enquire about a transfer
            transfers.transactions.create: Create a transfer transaction
            transfers.transactions.query: Query transfer transactions
            bills.categories.list: View bill categories
            bills.billers.list: View billers
            bills.bill.validate: Validate a bill
            bills.transactions.create: Create a bill transaction
            disputes.categories.list: View dispute categories
            disputes.report.create: Create a dispute report
            disputes.report.readonly: View disputes
            direct-debits.create: Create a direct debit
            direct-debits.update: Update a direct debit
            direct-debits.list: View and manage direct debits
            direct-debits.readonly: View existing direct debits
            direct-debits.transaction.create: Create a direct debit transaction
            cards.list: View and manage cards
            cards.update: Update a card
            cards.create: Create a card
            loans.list: View and manage loans
            savings.list: View and manage savings
            savings.transactions.list: View and manage savings transactions

````