> For a complete page index, fetch https://docs.transak.com/llms.txt

# Get Saved Cards

GET https://api-gateway-stg.transak.com/api/v2/payment-instrument/status

The **Get Saved Cards** is an **authenticated API** that retrieves the user's saved credit/debit cards.

Reference: https://docs.transak.com/api/whitelabel/payments/headless-cards/get-saved-cards

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: whitelabel-api
  version: 1.0.0
paths:
  /api/v2/payment-instrument/status:
    get:
      operationId: get-saved-cards
      summary: Get Saved Cards
      description: >-
        The **Get Saved Cards** is an **authenticated API** that retrieves the
        user's saved credit/debit cards.
      tags:
        - headlessCards
      parameters:
        - name: paymentInstrumentId
          in: query
          description: >-
            Payment instrument identifier. Only `credit_debit_card` is supported
            for retrieving saved cards.
          required: true
          schema:
            type: string
        - name: x-user-ip
          in: header
          description: >-
            End user's originating IP. More details
            [here](/guides/mandatory-security-changes#user-ip-header-in-apis)
          required: true
          schema:
            type: string
        - name: x-api-key
          in: header
          description: Partner API Key present in Transak Dashboard.
          required: true
          schema:
            type: string
        - name: authorization
          in: header
          description: >-
            Authorization token is the accessToken received from the API -`
            api/v2/auth/verify`


            Note: This is not applicable for [Auth Reliance
            Flows](/features/auth-reliance)
          required: false
          schema:
            type: string
        - name: x-user-identifier
          in: header
          description: >-
            Your authenticated user Email Id address.


            Note: This is applicable only for [Auth Reliance
            Flows](/features/auth-reliance)
          required: false
          schema:
            type: string
        - name: x-access-token
          in: header
          description: >
            Your Partner Access Token. Please refer
            [here](/guides/how-to-create-partner-access-token) for a tutorial on
            generating your access token.


            Note: This is applicable only for [Auth Reliance
            Flows](/features/auth-reliance)
          required: false
          schema:
            type: string
      responses:
        '200':
          description: 200 - Success
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/headlessCards:get-saved-cards_Response_200
        '401':
          description: 401 - Unauthorized
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/headlessCards:Get-saved-cardsRequestUnauthorizedError
        '500':
          description: 500 - Internal Server Error
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/headlessCards:Get-saved-cardsRequestInternalServerError
servers:
  - url: https://api-gateway-stg.transak.com
    description: Staging
components:
  schemas:
    headlessCards:ApiV2PaymentInstrumentStatusGetResponsesContentApplicationJsonSchemaDataPaymentInstrumentsCreditDebitCardCardsItems:
      type: object
      properties:
        paymentIdentifierId:
          type: string
        bin:
          type: string
        last4:
          type: string
        scheme:
          type: string
        expiryMonth:
          type: integer
        expiryYear:
          type: integer
      title: >-
        ApiV2PaymentInstrumentStatusGetResponsesContentApplicationJsonSchemaDataPaymentInstrumentsCreditDebitCardCardsItems
    headlessCards:ApiV2PaymentInstrumentStatusGetResponsesContentApplicationJsonSchemaDataPaymentInstrumentsCreditDebitCard:
      type: object
      properties:
        cards:
          type: array
          items:
            $ref: >-
              #/components/schemas/headlessCards:ApiV2PaymentInstrumentStatusGetResponsesContentApplicationJsonSchemaDataPaymentInstrumentsCreditDebitCardCardsItems
      required:
        - cards
      title: >-
        ApiV2PaymentInstrumentStatusGetResponsesContentApplicationJsonSchemaDataPaymentInstrumentsCreditDebitCard
    headlessCards:ApiV2PaymentInstrumentStatusGetResponsesContentApplicationJsonSchemaDataPaymentInstruments:
      type: object
      properties:
        credit_debit_card:
          $ref: >-
            #/components/schemas/headlessCards:ApiV2PaymentInstrumentStatusGetResponsesContentApplicationJsonSchemaDataPaymentInstrumentsCreditDebitCard
      title: >-
        ApiV2PaymentInstrumentStatusGetResponsesContentApplicationJsonSchemaDataPaymentInstruments
    headlessCards:ApiV2PaymentInstrumentStatusGetResponsesContentApplicationJsonSchemaData:
      type: object
      properties:
        paymentInstruments:
          $ref: >-
            #/components/schemas/headlessCards:ApiV2PaymentInstrumentStatusGetResponsesContentApplicationJsonSchemaDataPaymentInstruments
      required:
        - paymentInstruments
      title: ApiV2PaymentInstrumentStatusGetResponsesContentApplicationJsonSchemaData
    headlessCards:get-saved-cards_Response_200:
      type: object
      properties:
        data:
          $ref: >-
            #/components/schemas/headlessCards:ApiV2PaymentInstrumentStatusGetResponsesContentApplicationJsonSchemaData
      required:
        - data
      title: get-saved-cards_Response_200
    headlessCards:ApiV2PaymentInstrumentStatusGetResponsesContentApplicationJsonSchemaError:
      type: object
      properties:
        statusCode:
          type: integer
        message:
          type: string
      required:
        - statusCode
        - message
      title: >-
        ApiV2PaymentInstrumentStatusGetResponsesContentApplicationJsonSchemaError
    headlessCards:Get-saved-cardsRequestUnauthorizedError:
      type: object
      properties:
        error:
          $ref: >-
            #/components/schemas/headlessCards:ApiV2PaymentInstrumentStatusGetResponsesContentApplicationJsonSchemaError
      required:
        - error
      title: Get-saved-cardsRequestUnauthorizedError
    headlessCards:Get-saved-cardsRequestInternalServerError:
      type: object
      properties:
        error:
          $ref: >-
            #/components/schemas/headlessCards:ApiV2PaymentInstrumentStatusGetResponsesContentApplicationJsonSchemaError
      required:
        - error
      title: Get-saved-cardsRequestInternalServerError

```

## Examples



**Response**

```json
{
  "data": {
    "paymentInstruments": {
      "credit_debit_card": {
        "cards": [
          {
            "paymentIdentifierId": "6a3bb239134657c1abdc245d",
            "bin": "48003376",
            "last4": "5182",
            "scheme": "VISA",
            "expiryMonth": 10,
            "expiryYear": 2033
          }
        ]
      }
    }
  }
}
```

**SDK Code**

```python Success
import requests

url = "https://api-gateway-stg.transak.com/api/v2/payment-instrument/status"

querystring = {"paymentInstrumentId":"credit_debit_card"}

headers = {
    "x-api-key": "",
    "x-user-ip": ""
}

response = requests.get(url, headers=headers, params=querystring)

print(response.json())
```

```javascript Success
const url = 'https://api-gateway-stg.transak.com/api/v2/payment-instrument/status?paymentInstrumentId=credit_debit_card';
const options = {method: 'GET', headers: {'x-api-key': '', 'x-user-ip': ''}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Success
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://api-gateway-stg.transak.com/api/v2/payment-instrument/status?paymentInstrumentId=credit_debit_card"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("x-api-key", "")
	req.Header.Add("x-user-ip", "")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Success
require 'uri'
require 'net/http'

url = URI("https://api-gateway-stg.transak.com/api/v2/payment-instrument/status?paymentInstrumentId=credit_debit_card")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["x-api-key"] = ''
request["x-user-ip"] = ''

response = http.request(request)
puts response.read_body
```

```java Success
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://api-gateway-stg.transak.com/api/v2/payment-instrument/status?paymentInstrumentId=credit_debit_card")
  .header("x-api-key", "")
  .header("x-user-ip", "")
  .asString();
```

```php Success
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api-gateway-stg.transak.com/api/v2/payment-instrument/status?paymentInstrumentId=credit_debit_card', [
  'headers' => [
    'x-api-key' => '',
    'x-user-ip' => '',
  ],
]);

echo $response->getBody();
```

```csharp Success
using RestSharp;

var client = new RestClient("https://api-gateway-stg.transak.com/api/v2/payment-instrument/status?paymentInstrumentId=credit_debit_card");
var request = new RestRequest(Method.GET);
request.AddHeader("x-api-key", "");
request.AddHeader("x-user-ip", "");
IRestResponse response = client.Execute(request);
```

```swift Success
import Foundation

let headers = [
  "x-api-key": "",
  "x-user-ip": ""
]

let request = NSMutableURLRequest(url: NSURL(string: "https://api-gateway-stg.transak.com/api/v2/payment-instrument/status?paymentInstrumentId=credit_debit_card")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```