This page is for admins who make Buttons.

OneClick reads the data of a Pipedrive record through the Pipedrive API. A Workflow button and a Link button use
[Pipedrive API v2](https://pipedrive.readme.io/docs/pipedrive-api-v2) or API v1. API v2 is faster and more reliable
than API v1. Pipedrive recommends that applications move to API v2.

- A new Button uses API v2.
- An Interface button has no API version.
- The Buttons list shows the API version of each Button: **V2** or **V1**. See
  [Manage Buttons](/docs/buttons/manage-buttons).

The field data of API v2 is partially different from API v1. Some fields have a different key, and some fields are
not in API v2. Thus a migrated Workflow button can send a different payload. Migrate each Button one at a time, and
test it before the users see it.

## 1. Make a test copy of the Button

1. Duplicate the Button. See [Duplicate a Button](/docs/buttons/manage-buttons#duplicate-a-button).
2. Click **Edit** on the copy.
3. Turn on the switch of **Limit Visibility** and click **Limit Visibility**.
4. In **Show for users**, select only yourself, or only the users who test the Button. See
   [Limit visibility](/docs/buttons/limit-visibility).
5. Click **Save**. The other users do not see the copy.

## 2. Switch the copy to API v2

1. Click **Button** in the menu at the left.
2. Turn on **Use Pipedrive API v2**.

![The switch Use Pipedrive API v2 in the Button section of the Button editor](https://res.cloudinary.com/zimple/image/upload/f_auto,q_auto/oneclick-docs/buttons/migrate-to-api-v2/api-v2-toggle.png)

## 3. Select the fields again

OneClick looks for each field of the Button in API v2. A field that is not in API v2 gets the text
**(Removed or unavailable for this API version)** after its name. The menu item of its section shows a red error icon.

For a Workflow button:

1. Click **Custom Fields** in the menu at the left.
2. Find the fields with the error icon.
3. Click a field and select the correct API v2 field in the field selection.
4. Do steps 2 and 3 again for all fields with an error.
5. If the Button uses advanced validation, examine the rules. Select the fields of the rules again.

For a Link button:

1. Click **Dynamic URL** in the menu at the left.
2. Find the URL parts with the error icon.
3. Delete each part with an error. Add a dynamic field at the same position and select the correct API v2 field.

When no section shows an error icon, click **Save**.

## 4. Test the copy

- **Link button.** Press the copy in Pipedrive. Make sure that the URL is correct.
- **Workflow button.** Press the original Button and then the copy on the same record. Compare the two payloads that
  your process receives. Change your process for the differences.

The request of a Workflow button has the header `X-oc-pipedrive-api-version` with the value `v1` or `v2`. Your process
can use it to read both payload types.

If you use Make, Zapier or another automation tool, you can also duplicate your workflow. Connect the copy of the
Button to the copy of the workflow. The original Button and workflow then work while you test.

## 5. Publish the migrated Button

1. Open the copy and click **Limit Visibility**.
2. Remove the users that you selected in step 1, or turn off the switch of **Limit Visibility**.
3. Click **Save**. All users now see the migrated Button.
4. Delete the original Button, or limit it so that the users do not see it. See
   [Delete a Button](/docs/buttons/manage-buttons#delete-a-button).
