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

# Read the PIN

> Returns the PIN encrypted to the key of the application, after the
account owner signed a `cards.read_pin.v1` challenge. The application
calls this route directly; your backend never sees the request or the
reply. The route takes no access token and allows any CORS origin.

The errors are those of `POST /v1/cards/details`.



## OpenAPI

````yaml https://core.sandbox.gnosispay.in/partner-api/openapi.json post /v1/cards/pin/details
openapi: 3.2.0
info:
  title: Gnosis Pay Partner API
  version: 1.0.0
  description: >-
    Server-to-server API for onboarding users, creating accounts and cards,
    moving

    funds, and managing the card lifecycle. Call this API only from a trusted

    backend. Every request requires a partner access token, and every resource
    is

    scoped to the authenticated partner. The exceptions are the routes that the

    cardholder's application calls directly to read and change card data

    (`GET /v1/challenge/keys` and the card routes of the encrypted data

    protocol): they take no token and allow any CORS origin.
servers:
  - url: https://core.prod.gnosispay.com/partner-api
    description: Production
    variables: {}
  - url: https://core.sandbox.gnosispay.in/core
    description: Sandbox
    variables: {}
security:
  - BearerAuth: []
tags:
  - name: KYC
  - name: Accounts
  - name: Cards
  - name: Encrypted data
    description: >-
      Lets the cardholder's application read the card data (PAN, CVV, expiration

      date and PIN) and set a new PIN. The card data is encrypted between the

      application and GP. Your backend and your network never see it, even when

      a request passes through them.


      ## Goals


      - Only the application and GP can read the card data or the new PIN.

      - The account owner approves each action: the cardholder's wallet signs an
        EIP-712 message for it.
      - Your access token alone cannot read or change card data.

      - The application can verify that each challenge and each reply came from
        GP.

      ## Algorithms


      | Use | Algorithm |

      |---|---|

      | Keys | `EC` on the `P-256` curve |

      | Signature (JWS) | `ES256` |

      | Key agreement (JWE) | `ECDH-ES` |

      | Content encryption (JWE) | `A256GCM` |

      | Key thumbprint | RFC 7638 with SHA-256, base64url without padding |

      | Wallet signature | EIP-712 (`eth_signTypedData_v4`), checked with
      ERC-1271 for a smart account |


      Every token is a JWT. A standard JOSE library can create and verify all of

      them.


      ## Flow


      ```mermaid

      sequenceDiagram
          autonumber
          participant APP as Application
          participant WALLET as Wallet
          participant BACKEND as Your backend
          participant GP

          APP->>APP: create a signature key pair and an encryption key pair
          APP->>BACKEND: thumbprint of the signature public key
          BACKEND->>GP: POST /v1/challenge
          GP-->>BACKEND: challenge (JWS)
          BACKEND-->>APP: challenge
          APP->>GP: GET /v1/challenge/keys
          GP-->>APP: GP public keys (JWKS)
          APP->>APP: verify the challenge
          APP->>WALLET: sign the EIP-712 message of the challenge
          WALLET-->>APP: signature
          APP->>GP: POST /v1/cards/... with the signed and encrypted answer (JWE)
          alt read the card details or the PIN
              GP-->>APP: data (JWE that holds a JWS)
          else change the PIN
              GP-->>APP: proof (JWS)
          end
          APP->>APP: verify the reply and delete both key pairs
      ```
  - name: PCI
  - name: 3DS
  - name: Card transactions
  - name: Deposits
  - name: Withdrawals
  - name: Webhooks
paths:
  /v1/cards/pin/details:
    post:
      tags:
        - Encrypted data
      summary: Read the PIN
      description: |-
        Returns the PIN encrypted to the key of the application, after the
        account owner signed a `cards.read_pin.v1` challenge. The application
        calls this route directly; your backend never sees the request or the
        reply. The route takes no access token and allows any CORS origin.

        The errors are those of `POST /v1/cards/details`.
      operationId: cards.read_pin.v1
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ChallengeAnswerRequest'
      responses:
        '200':
          description: The request has succeeded.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PinDetailsReply'
        default:
          description: An unexpected error response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - {}
components:
  schemas:
    ChallengeAnswerRequest:
      type: object
      required:
        - answer
      properties:
        answer:
          $ref: '#/components/schemas/ClientAnswerJwe'
          description: The answer of the application to the challenge.
      description: The body of every card route.
    PinDetailsReply:
      type: object
      required:
        - data
      properties:
        data:
          $ref: '#/components/schemas/PinDetailsJwe'
          description: The PIN.
    Error:
      type: object
      required:
        - code
        - message
      properties:
        code:
          type: integer
          format: int32
          description: HTTP status code.
        message:
          type: string
          description: Generic human-readable text for the status code. Do not parse it.
        reason:
          type: string
          description: >-
            Stable machine-readable code identifying the specific cause, present
            only

            for errors that expose one (e.g. `CREATE_CARD_LIMIT_EXCEEDED`).
            Branch on

            this rather than on `message`.
    ClientAnswerJwe:
      type: string
      maxLength: 16384
      format: jwt
      description: >-
        A compact JWE (`ClientAnswerJweHeader`) to the GP encryption key that
        the

        `gp_enc_kid` claim of the challenge names. Its plaintext is a compact
        JWS

        (`ClientAnswerJwsHeader`) that the application signed with the private
        key

        of `client_sig_jwk`, with the claims `ClientAnswerClaims`.
      x-jwt-claims-schema: '#/components/schemas/ClientAnswerClaims'
      x-jws-header-schema: '#/components/schemas/ClientAnswerJwsHeader'
      x-jose-header-schema: '#/components/schemas/ClientAnswerJweHeader'
    PinDetailsJwe:
      type: string
      format: jwt
      description: |-
        A compact JWE (`ReplyJweHeader`) to `client_enc_jwk`. Its plaintext is a
        compact JWS (`ReplyJwsHeader`) that GP signed, with the claims
        `PinDetailsClaims`.

        The application decrypts and verifies it as `CardDetailsJwe`.
      x-jwt-claims-schema: '#/components/schemas/PinDetailsClaims'
      x-jws-header-schema: '#/components/schemas/ReplyJwsHeader'
      x-jose-header-schema: '#/components/schemas/ReplyJweHeader'
  securitySchemes:
    BearerAuth:
      type: http
      scheme: Bearer

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.