---
title: "Link card with account or customer"
method: POST
path: "/pty/account/v1/pws_link_card_acc"
tags: ["Ledger API - Cards"]
---

# Link card with account or customer

`POST /pty/account/v1/pws_link_card_acc`

## Request

- Base URL: `https://api.uat.paymentology.com`
- URL: `https://api.uat.paymentology.com/pty/account/v1/pws_link_card_acc`
- Auth: HTTP bearer

<ul>
<li class="docBullet">Ledger API version of the PWS <a href="https://developer.paymentology.com/bankinglive/reference/v2_pws_link_card_account">Link account card V2</a> call. Request and response use the same format, served by the Ledger API.</li>
<li class="docBullet">The target account must be linked to a program.</li>
</ul>

## Request body

- LedgerLinkCardAccountRequest
  - `action` 0 | 1 | 2, required: Action type: 0 = Link card and account or customer 1 = Unlink card and account or customer (not yet available) 2 = Link card for replacement purpose
  - `api_call_unique_identifier` string, required: Unique number that must be passed at each API request. Identifier to make each API request unique
  - `client_id` integer, required: Unique identifier for the client which Paymentology will provide at outset
  - `token` integer, required: Public token for the card
  - `user_id` string: User Id of the Customer who triggered the API request
  - `remarks` string: Remarks for API request
  - `old_token` integer: Existing public token Linking existing token with new blank token will serve as replacement. Required when action = 2
  - `ac_id` integer: Account id Client can link account and customer id during account creation itself and pass while linking with card. Required when action = 0 Pass customer also id if an account is not linked to any customer yet
  - `ac_ext_ref` string: Account external reference Client can link ac_ext_ref/account and customer id during account creation itself and pass while linking with card. Required when action = 0 Client should use unique ac_ext_ref while linking with card Pass customer id also if an ac_ext_ref/account is not linked to any customer yet
  - `cu_id` integer: Customer id. Pass a valid customer id, otherwise linking with the account or token is skipped. If no customer id is passed, make sure the account and customer are already linked.
  - `inherit_rules` integer: Inherit existing card rules. Based on value provide, it will either inherit existing rules or skip. 0 = Inherit 1 = Do not inherit Default value is 0 i.e. always inherit

## Response `200`

Request processed. Check `header.error_id`: `0` means success. Any other value is a business error, reported with HTTP 200 and an empty `body`. Common codes: 992 (invalid account id), 993 (invalid card token), 995 (validation failed), 1043 (account does not belong to the client), 1055 (invalid program_code), 1531 (invalid customer id).

- LedgerLinkCardAccountResponse
  - `header` LedgerApiHeader, required
    - `error_id` integer, required
    - `error_desc` string, required
  - `body` object, required
    - `token` integer: Public token
    - `ac_id` integer: Account id

## Other responses

- `400`: Request validation failed (missing or invalid fields, unknown fields, malformed JSON, or `client_id` not matching the access token). `header.error_id` is 400 and `header.error_desc` describes the failure.
- `401`: Missing or invalid access token. Empty body.
- `403`: Access token rejected by the API gateway (for example, expired).
- `404`: The customer or account was not found. `header.error_id` is 997.
- `413`: Request body too large. `header.error_id` is 413.
- `500`: Unexpected error. `header.error_id` is 900.

---

[API](https://skmtc.dev/paymentology/apis/ledger-api.md) - [All operations](https://skmtc.dev/paymentology/apis/ledger-api/llms.txt) - [OpenAPI document](https://skmtc.dev/paymentology/apis/ledger-api/revisions/a5700c501bee?raw)
