data delete bulk

Bulk delete records from an org using a CSV file. Uses Bulk API 2.0.

The CSV file must have only one column (“Id”) and then the list of record IDs you want to delete, one ID per line.

When you execute this command, it starts a job, displays the ID, and then immediately returns control of the terminal to you by default. If you prefer to wait, set the –wait flag to the number of minutes; if it times out, the command outputs the IDs. Use the job ID to check the status of the job with the “sf data delete resume” command.

Flag Name (Long)Flag Name (Short)Description
‑‑api‑versionN/AType: Value

Override the api version used for api requests made by this command
‑‑file‑fType: Value
Required

CSV file that contains the IDs of the records to update or delete.
‑‑flags‑dirN/AType: Value

Import flag values from a directory.
‑‑hard‑deleteN/AType: Boolean

Mark the records as immediately eligible for deletion by your org. If you don’t specify this flag, the deleted records go into the Recycle Bin.

You must have the “Bulk API Hard Delete” system permission to use this flag. The permission is disabled by default and can be enabled only by a system administrator.
‑‑jsonN/AType: Boolean

Format output as json.
‑‑line‑endingN/AType: Value
Valid Values: CRLF, LF

Line ending used in the CSV file. Default value on Windows is CRLF; on macOS and Linux it’s LF.
‑‑sobject‑sType: Value
Required

API name of the Salesforce object, either standard or custom, that you want to update or delete records from.
‑‑target‑org‑oType: Value
Required

Username or alias of the target org. Not required if the target-org configuration variable is already set.
‑‑wait‑wType: Value

Number of minutes to wait for the command to complete before displaying the results.

Bulk delete Account records from your default org using the list of IDs in the “files/delete.csv” file:

Bulk delete records from a custom object in an org with alias my-scratch and wait 5 minutes for the command to complete: