Archiving Deals via API

We have about 4000 deals that need to be archived.

5 minutes later in the development room: “Should be easy. The Pipedrive API is great! We’ll just write a script to do this. I bet I can have the job done in 15 minutes.”

Alas, there does not seem to be such a feature with the API. We tried the same command with Leads (sending “is_archived” via a patch) hoping that maybe it just wasn’t documented. Alas, that did not work either.

Is there a hidden way to do this programatically? Otherwise it’s going to be really tedious (or require a hack to these Deals where we can then filter them in the dashboard and maybe do it with a more-bulk approach)…

Thanks!

Hi! First of all, thanks for raising the problem with documentation - is_archived property was indeed not properly documented for Deals PUT/PATCH endpoints. We will fix that in short order.

Passing the property in request body seems to work fine, though - the deal is archived when I tested.

If you’re using v1 endpoints (PUT):

curl --location --request PUT 'https://mycompany.pipedrive.com/api/v1/deals/123?api_token=xxx' \
--header 'Content-Type: application/json' \
--data '{
    "is_archived": true
}'

v2 (PATCH):

curl --location --request PATCH 'https://mycompany.pipedrive.com/api/v2/deals/123?api_token=xxx' \
--header 'Content-Type: application/json' \
--data '{
    "is_archived": true
}'

Can you please share your exact failing request?

That’s great news on archiving deals! I suspect I had a mixup between v1/v2 and didn’t try the right combo (we’re using v2). We will give this another go and assume that everything is good.

Thanks again!

1 Like