Skip to main content

REST API: Bulk DELETE Requests through Postman

This documentation will guide you through the process of deleting Custom Object instances in bulk.

Sharon avatar
Written by Sharon
Updated over a week ago

ℹ️ This process can also be used to delete Project, Task, and Note records in bulk using the REST API with Postman’s Collection Runner and a CSV file.

You can use this process to bulk delete users, accounts, or organization records if you wish, or you can send a CSV to our Support team, and they can assist with a bulk deletion.

For more information on Postman, including installation instructions and account setup, please review their customer-facing documentation.

Set Up Your Postman Environment

1. Create a new Environment

  • On the left-hand sidebar, select Environments

  • Select the + to create a new environment

  • Name your new environment

2. Define your Variables

  1. Click into the Add variable box

  2. Enter subdomain in the Variable column

  3. In the Value column, enter your subdomain. You can find your subdomain in the URL used to log into Vitally (i.e., https://yoursubdomain.vitally.io)

  4. Click into the new Add variable box below subdomain

  5. Enter auth in the Variable column

  6. In the Value column, paste your basic auth header

    1. To locate and copy your basic auth header:

      1. Navigate to the REST API Integration page and ensure the integration is enabled

      2. Hover your cursor over the black box under Basic Auth Header

      3. Click the blue Copy button

      4. If a key is not present, select the blue Create API key button, then follow steps 2 & 3 to copy your auth header

Example Variables:

Variable

Example value

subdomain

your-subdomain

auth

Basic <your_base64_auth>

3. Create a New Request

How To

How To Visual

Use the + sign at the top to Create New Request

Select DELETE from the menu options to the left

Enter this URL in the DEL request text field: For US-hosted customers:

https://{{subdomain}}.rest.vitally.io/resources/customObjects/:customObjectId/instances

For EU-hosted customers:

https://rest.vitally-eu.io/resources/customObjects/:customObjectId/instances

Enter the :customObjectId in the Params tab

1. Make sure you've selected Params below the request URL

2. In the Path Variables section, you’ll see the Key columns contains customObjectId

3. In the Value column, enter your Custom Object ID

To get the Custom Object ID:

  1. Navigate to Settings > Custom Objects, and select the Custom Object that you’re uploading new instances to

  2. In the URL, copy the slug at the end of the URL, after /custom-objects/

⚠️ If {{subdomain}} in the URL or {{auth}} in the Value column are red, you’ll need to select your Environment in the top right.

4. Add Your Headers

  • Below the request URL, select the Headers tab

    • In the Headers table, enter Content-Type in the Key column and application/json as the Value

    • In a new row, enter Authorization in the Key column and {{auth}} as the Value

Key

Value

Content-Type

application/json

Authorization

{{auth}}

5. Set the request body

In the Body tab, select the radio button for none

6. Save The DELETE Request

  • Use the disk icon to save this request into a Collection

  • Enter a name for the Request (e.g., “Bulk Delete Custom Objects”) in the Request name field

  • Create a new collection, or add to an existing one in the save workflow (e.g., “Vitally API Examples”)

  • Select the orange Save button

Prepare a CSV file

You’ll need a CSV file that contains the ID of the Custom Object instances you’re deleting. All records in the CSV should be from the same Custom Object type (ie, all Opportunity instances).

This is the Vitally ID, and not the external ID of the custom object instance. When exporting a table of custom object records from Vitally to CSV, this column will be included automatically as id.

Example file (delete_custom_objects.csv):

id                                                                        
23examp-le1x-4ed0-8a66-ddf6e7c72b0d
fcedb2f3-exam-ple2-aec0-52be29d96518

If copying the example CSV, be sure to replace the example IDs with ones from your Vitally instance that you wish to delete.

Run a Bulk Request

Postman will iterate through each row of your CSV and plug the Custom Object ID into your request, then send each request as an individual API call. Once the collection has completed its run, you’ll see the status codes, response bodies, and any failures. Failures can happen if traits or IDs don’t have a match. You can export the run log if needed.

Open the Collection Runner

How To

How To Visual

1. On the left-hand sidebar in Postman, select Collections

2. Hover the cursor over your new Collection and click the ... menu

3. Select Run from the menu options

1. At the top right, select your new environment from the drop-down menu: it likely says No Environment

2. Pin the environment to the Collection

1. On the right side, choose how you want to run your collection. If running this as a one-time event, you’ll likely choose Run manually

2. Under Run configuration > Data file click the Select file button to upload your CSV file and select to run it locally 3. In the middle panel, under Run Sequence, you’ll select the DEL request you saved earlier and uncheck any other boxes

4. Select the Run button (The button’s name will reflect the name of the collection you’re working in)

Tips and Common Issues

Unexpected characters in your request URL

Copying and pasting the request URL from another source will often add a carriage return. If you’re getting a 404 Not found error when running the Collection, check your URL for stray characters.

Invalid trait key or custom field not found

If you’re encountering an error, such as an invalid trait key or a custom field not found, ensure the keys within "traits" in your request body match the trait API keys in Vitally Trait Settings. These may be different than your CSV header names.

Confirm that the Subdomain matches your workspace

For US-hosted customers: https://{{subdomain}}.rest.vitally.io/resources/...

For EU-hosted customers, you do not need a {{subdomain}}, but ensure you're using the EU-endpoint: https://rest.vitally-eu.io/resources/...

Error: Custom object with id not found

If you're seeing the error "error": "Custom object with id not found”, double-check the Custom Object ID that you entered in your request URL. There may be an extra return or space character, or you may have copied the incorrect part of the URL. You can find your Custom Object ID here:

  1. Navigate to Settings > Custom Objects, and select the Custom Object that you’re uploading new instances to

  2. In the URL, copy the slug at the end of the URL, after /custom-objects/

Did this answer your question?