Salesforce Sales Cloud · Arazzo Workflow

Salesforce Sales Cloud Delete Stale Lead

Version 1.0.0

Find an unconverted Lead by email via SOQL, then delete the matched record.

1 workflow 2 source APIs 1 provider
View Spec View on GitHub CloudCRMCustomer ManagementEnterpriseSalesArazzoWorkflows

Provider

salesforce-sales-cloud

Workflows

delete-stale-lead
Locate an unconverted Lead and delete it.
Runs a SOQL query for an unconverted Lead by email, then deletes the matched record. Ends without a delete when no Lead matches.
2 steps inputs: accessToken, leadEmail outputs: deletedLeadId
1
findLead
Query for an unconverted Lead by email.
2
deleteLead
Delete the matched Lead by id.

Source API Descriptions

Arazzo Workflow Specification

Raw ↑
arazzo: 1.0.1
info:
  title: Salesforce Sales Cloud Delete Stale Lead
  summary: Find an unconverted Lead by email via SOQL, then delete the matched record.
  description: >-
    A cleanup pattern over the Query and SObject Rows resources. The workflow
    queries for an unconverted Lead by email, branches on whether one was found,
    and when matched deletes the Lead by id. When nothing matches the workflow
    ends without a delete. Every step inlines its request and the OAuth bearer
    Authorization header.
  version: 1.0.0
sourceDescriptions:
- name: queryApi
  url: ../openapi/salesforce-sales-cloud-query-api-openapi.yml
  type: openapi
- name: sobjectRowsApi
  url: ../openapi/salesforce-sales-cloud-sobject-rows-api-openapi.yml
  type: openapi
workflows:
- workflowId: delete-stale-lead
  summary: Locate an unconverted Lead and delete it.
  description: >-
    Runs a SOQL query for an unconverted Lead by email, then deletes the matched
    record. Ends without a delete when no Lead matches.
  inputs:
    type: object
    required:
    - accessToken
    - leadEmail
    properties:
      accessToken:
        type: string
        description: OAuth 2.0 access token used as the Bearer credential.
      leadEmail:
        type: string
        description: Email of the Lead to match in the SOQL WHERE clause.
  steps:
  - stepId: findLead
    description: Query for an unconverted Lead by email.
    operationId: executeSOQLQuery
    parameters:
    - name: Authorization
      in: header
      value: Bearer $inputs.accessToken
    - name: q
      in: query
      value: "SELECT Id FROM Lead WHERE Email = '$inputs.leadEmail' AND IsConverted = false LIMIT 1"
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      totalSize: $response.body#/totalSize
      leadId: $response.body#/records/0/Id
    onSuccess:
    - name: leadFound
      type: goto
      stepId: deleteLead
      criteria:
      - context: $response.body
        condition: $.totalSize > 0
        type: jsonpath
    - name: leadMissing
      type: end
      criteria:
      - context: $response.body
        condition: $.totalSize == 0
        type: jsonpath
  - stepId: deleteLead
    description: Delete the matched Lead by id.
    operationId: deleteSObjectRecord
    parameters:
    - name: Authorization
      in: header
      value: Bearer $inputs.accessToken
    - name: sObjectName
      in: path
      value: Lead
    - name: recordId
      in: path
      value: $steps.findLead.outputs.leadId
    successCriteria:
    - condition: $statusCode == 204
  outputs:
    deletedLeadId: $steps.findLead.outputs.leadId

Work with this as data

Every workflow here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for arazzo workflows

4 MCP tools reach this
  • find_arazzoBrowse and filter every workflow in the catalog.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This workflow
curl "https://apis.io/api/v1/arazzo/salesforce-sales-cloud-delete-stale-lead-workflow"
All arazzo workflows
curl "https://apis.io/api/v1/arazzo?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.