# Set up Custom Data Fields
source: https://developer.mastercard.com/business-payment-controls/documentation/use-cases/04-custom-data-fields/index.md

This API supports the following use cases for real cards:

## Custom data fields {#custom-data-fields}

* [Create](https://developer.mastercard.com/business-payment-controls/documentation/use-cases/04-custom-data-fields/index.md#create-custom-data-fields) custom data fields
* [Update](https://developer.mastercard.com/business-payment-controls/documentation/use-cases/04-custom-data-fields/index.md#update-custom-data-fields) custom data fields
* [Delete](https://developer.mastercard.com/business-payment-controls/documentation/use-cases/04-custom-data-fields/index.md#delete-custom-data-fields) custom data fields
* [Search](https://developer.mastercard.com/business-payment-controls/documentation/use-cases/04-custom-data-fields/index.md#search-for-custom-data-field-details) for custom data field details
* [Get](https://developer.mastercard.com/business-payment-controls/documentation/use-cases/04-custom-data-fields/index.md#get-custom-data-field-details) custom data field details
* [Associate](https://developer.mastercard.com/business-payment-controls/documentation/use-cases/04-custom-data-fields/index.md#associate-custom-data-with-a-card) custom data with a card
* [Update](https://developer.mastercard.com/business-payment-controls/documentation/use-cases/04-custom-data-fields/index.md#update-custom-data-field-to-card-association) custom data field to card association
* [Get](https://developer.mastercard.com/business-payment-controls/documentation/use-cases/04-custom-data-fields/index.md#get-custom-data-fields) custom data fields
* [Delete](https://developer.mastercard.com/business-payment-controls/documentation/use-cases/04-custom-data-fields/index.md#delete-the-association-between-a-custom-data-field-and-a-card) the association between a custom data field and a card

## Create custom data fields {#create-custom-data-fields}

Create custom data fields with the `POST/custom-data` endpoint. When the custom data fields are created, a custom data field identifier is generated and returned in the API response.
Warning: Do not pass PII or PCI data when creating custom data fields. Diagram 04-create-a-cdf
API Reference: `POST /custom-data`

## Update custom data fields {#update-custom-data-fields}

Update existing custom data fields with the `PUT/custom-data/{custom_data_guid}` endpoint by passing the custom data field identifier.
Diagram 04-update-a-cdf
API Reference: `PUT /custom-data/{custom_data_guid}`

## Delete custom data fields {#delete-custom-data-fields}

Delete a custom data field with the `DELETE/custom-data/{custom_data_guid}` endpoint.
Diagram 04-delete-a-cdf
API Reference: `DELETE /custom-data/{custom_data_guid}`

## Search for custom data field details {#search-for-custom-data-field-details}

Search for custom data field details with the `POST /custom-data/searches` endpoint.

All search criteria are optional. If no search criteria are added, all custom data fields are returned, depending on access permissions. Add more specific criteria to narrow the search to retrieve specific custom data.
Diagram 04-search-a-cdf
API Reference: `POST /custom-data/searches`

## Get custom data field details {#get-custom-data-field-details}

Get custom data field details with the `GET/custom-data/{custom_data_guid}` endpoint.
Diagram 04-get-a-cdf
API Reference: `GET /custom-data/{custom_data_guid}`

## Associate custom data with a card {#associate-custom-data-with-a-card}

Associate custom data fields with real and virtual cards as follows:

* Real cards: `POST/funding-sources` endpoint
* Virtual cards: `POST/virtual-card-accounts` endpoint

### Real cards {#real-cards}

Custom data fields are associated with real cards through the funding source. Associating custom data fields with a real card is optional. Custom data fields can be associated with existing funding sources by using the [Update a custom data field](https://developer.mastercard.com/business-payment-controls/documentation/use-cases/04-custom-data-fields/index.md#update-a-custom-data-field) operation.
Diagram 04-associate-real-cdf
API Reference: `POST /funding-sources`

### Virtual cards {#virtual-cards}

Associating a custom data field with a virtual card is optional. Custom data fields can be associated with existing virtual cards by using the [Update a custom data field](https://developer.mastercard.com/business-payment-controls/documentation/use-cases/04-custom-data-fields/index.md#update-a-custom-data-field) operation.
Diagram 04-associate-virt-cdf
API Reference: `POST /virtual-card-accounts`

## Update custom data field to card association {#update-custom-data-field-to-card-association}

Update associations between a custom data field and real and virtual cards as follows:

* Real cards: `PUT/funding-sources/{funding_source_guid}` endpoint
* Virtual cards: `PUT/virtual-card-accounts/{account_guid}` endpoint

These endpoints can be used to:

* Associate new custom data fields with a real card or virtual cards.
* Update the association of existing custom data fields with a real card or virtual cards.

### Real card {#real-card}

If the real card has a custom data field associated with it when the card is created, the custom data field is updated. Updating the association of a custom data fields to a real card is optional. The real card data can be updated without updating the custom data fields.
Diagram 04-update-associate-real-cdf
API Reference: `PUT /funding-sources/{funding_source_guid}`

### Virtual card {#virtual-card}

This endpoint updates custom data fields associated with virtual cards. Updating the association of a custom data fields to a virtual card is optional. The virtual card data can be updated without updating the custom data field.
Diagram 04-update-associate-virt-cdf
API Reference: `PUT /virtual-card-accounts/{account_guid}`

## Get custom data fields {#get-custom-data-fields}

Get custom data fields associated with real and virtual cards as follows:

* Real cards: `GET/funding-sources/{funding_source_guid}` endpoint.
* Virtual cards: `GET/virtual-card-accounts/{account_guid}` endpoint.

### Real card {#real-card-1}

To get custom data fields associated with a real card:
Diagram 04-get-a-real-cdf
API Reference: `GET /funding-sources/{funding_source_guid}`

### Virtual card {#virtual-card-1}

To get custom data fields associated with a virtual card:
Diagram 04-get-a-virt-cdf
API Reference: `GET /virtual-card-accounts/{account_guid}`

## Delete the association between a custom data field and a card {#delete-the-association-between-a-custom-data-field-and-a-card}

Delete the association between a custom data field and a card as follows:

* Real cards: `PUT/funding-sources/{funding_source_guid}`
* Virtual cards: `PUT/virtual-card-accounts/{account_guid}`

### Real card {#real-card-2}

To delete custom data fields associated with a real card.
Diagram 04-delete-associate-real-cdf
API Reference: `PUT /funding-sources/{funding_source_guid}`

### Virtual card {#virtual-card-2}

To delete custom data fields associated with a virtual card.
Diagram 04-delete-associate-virt-cdf
API Reference: `PUT /virtual-card-accounts/{account_guid}`

