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

# Delete Saved Cards

DELETE https://api-gateway-stg.transak.com/api/v2/user/cards/{paymentIdentifierId}

The **Delete Saved Cards** is an **authenticated API** that deletes a user's saved credit/debit card.

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

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: whitelabel-api
  version: 1.0.0
paths:
  /api/v2/user/cards/{paymentIdentifierId}:
    delete:
      operationId: delete-saved-cards
      summary: Delete Saved Cards
      description: >-
        The **Delete Saved Cards** is an **authenticated API** that deletes a
        user's saved credit/debit card.
      tags:
        - headlessCards
      parameters:
        - name: paymentIdentifierId
          in: path
          description: >-
            Identifier of the saved card to delete, returned as
            `paymentIdentifierId` by the [Get Saved Cards
            API](/api/whitelabel/payments/headless-cards/get-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-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
        - name: x-user-identifier
          in: header
          description: >-
            The authenticated user's email address.


            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:delete-saved-cards_Response_200
        '400':
          description: 400 - Bad Request
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/headlessCards:Delete-saved-cardsRequestBadRequestError
        '401':
          description: 401 - Unauthorized
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/headlessCards:Delete-saved-cardsRequestUnauthorizedError
        '403':
          description: 403 - Forbidden
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/headlessCards:Delete-saved-cardsRequestForbiddenError
        '500':
          description: 500 - Internal Server Error
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/headlessCards:Delete-saved-cardsRequestInternalServerError
servers:
  - url: https://api-gateway-stg.transak.com
    description: Staging
components:
  schemas:
    headlessCards:ApiV2UserCardsPaymentIdentifierIdDeleteResponsesContentApplicationJsonSchemaData:
      type: object
      properties:
        status:
          type: string
        message:
          type: string
      required:
        - status
        - message
      title: >-
        ApiV2UserCardsPaymentIdentifierIdDeleteResponsesContentApplicationJsonSchemaData
    headlessCards:delete-saved-cards_Response_200:
      type: object
      properties:
        data:
          $ref: >-
            #/components/schemas/headlessCards:ApiV2UserCardsPaymentIdentifierIdDeleteResponsesContentApplicationJsonSchemaData
      required:
        - data
      title: delete-saved-cards_Response_200
    headlessCards:ApiV2UserCardsPaymentIdentifierIdDeleteResponsesContentApplicationJsonSchemaError:
      type: object
      properties:
        statusCode:
          type: integer
        message:
          type: string
        errorCode:
          type: integer
      required:
        - statusCode
        - message
      title: >-
        ApiV2UserCardsPaymentIdentifierIdDeleteResponsesContentApplicationJsonSchemaError
    headlessCards:Delete-saved-cardsRequestBadRequestError:
      type: object
      properties:
        error:
          $ref: >-
            #/components/schemas/headlessCards:ApiV2UserCardsPaymentIdentifierIdDeleteResponsesContentApplicationJsonSchemaError
      required:
        - error
      title: Delete-saved-cardsRequestBadRequestError
    headlessCards:Delete-saved-cardsRequestUnauthorizedError:
      type: object
      properties:
        error:
          $ref: >-
            #/components/schemas/headlessCards:ApiV2UserCardsPaymentIdentifierIdDeleteResponsesContentApplicationJsonSchemaError
      required:
        - error
      title: Delete-saved-cardsRequestUnauthorizedError
    headlessCards:Delete-saved-cardsRequestForbiddenError:
      type: object
      properties:
        error:
          $ref: >-
            #/components/schemas/headlessCards:ApiV2UserCardsPaymentIdentifierIdDeleteResponsesContentApplicationJsonSchemaError
      required:
        - error
      title: Delete-saved-cardsRequestForbiddenError
    headlessCards:Delete-saved-cardsRequestInternalServerError:
      type: object
      properties:
        error:
          $ref: >-
            #/components/schemas/headlessCards:ApiV2UserCardsPaymentIdentifierIdDeleteResponsesContentApplicationJsonSchemaError
      required:
        - error
      title: Delete-saved-cardsRequestInternalServerError

```

## Examples



**Response**

```json
{
  "data": {
    "status": "success",
    "message": "Card deleted successfully"
  }
}
```

**SDK Code**

```python Success
import requests

url = "https://api-gateway-stg.transak.com/api/v2/user/cards/6a3bb239134657c1abdc245d"

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

response = requests.delete(url, headers=headers)

print(response.json())
```

```javascript Success
const url = 'https://api-gateway-stg.transak.com/api/v2/user/cards/6a3bb239134657c1abdc245d';
const options = {method: 'DELETE', 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/user/cards/6a3bb239134657c1abdc245d"

	req, _ := http.NewRequest("DELETE", 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/user/cards/6a3bb239134657c1abdc245d")

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

request = Net::HTTP::Delete.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.delete("https://api-gateway-stg.transak.com/api/v2/user/cards/6a3bb239134657c1abdc245d")
  .header("x-api-key", "")
  .header("x-user-ip", "")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('DELETE', 'https://api-gateway-stg.transak.com/api/v2/user/cards/6a3bb239134657c1abdc245d', [
  '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/user/cards/6a3bb239134657c1abdc245d");
var request = new RestRequest(Method.DELETE);
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/user/cards/6a3bb239134657c1abdc245d")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "DELETE"
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()
```