Use DeleteTranscriptionJob with an AWS SDK or command line tool - AWS SDK Code Examples

There are more AWS SDK examples available in the AWS Doc SDK Examples GitHub repo.

Use DeleteTranscriptionJob with an AWS SDK or command line tool

The following code examples show how to use DeleteTranscriptionJob.

Action examples are code excerpts from larger programs and must be run in context. You can see this action in context in the following code example:

.NET
AWS SDK for .NET
Note

There's more on GitHub. Find the complete example and learn how to set up and run in the AWS Code Examples Repository.

/// <summary> /// Delete a transcription job. Also deletes the transcript associated with the job. /// </summary> /// <param name="jobName">Name of the transcription job to delete.</param> /// <returns>True if successful.</returns> public async Task<bool> DeleteTranscriptionJob(string jobName) { var response = await _amazonTranscribeService.DeleteTranscriptionJobAsync( new DeleteTranscriptionJobRequest() { TranscriptionJobName = jobName }); return response.HttpStatusCode == HttpStatusCode.OK; }
CLI
AWS CLI

To delete one of your transcription jobs

The following delete-transcription-job example deletes one of your transcription jobs.

aws transcribe delete-transcription-job \ --transcription-job-name your-transcription-job

This command produces no output.

For more information, see DeleteTranscriptionJob in the Amazon Transcribe Developer Guide.

JavaScript
SDK for JavaScript (v3)
Note

There's more on GitHub. Find the complete example and learn how to set up and run in the AWS Code Examples Repository.

Delete a transcription job.

// Import the required AWS SDK clients and commands for Node.js import { DeleteTranscriptionJobCommand } from "@aws-sdk/client-transcribe"; import { transcribeClient } from "./libs/transcribeClient.js"; // Set the parameters export const params = { TranscriptionJobName: "JOB_NAME", // Required. For example, 'transciption_demo' }; export const run = async () => { try { const data = await transcribeClient.send( new DeleteTranscriptionJobCommand(params) ); console.log("Success - deleted"); return data; // For unit tests. } catch (err) { console.log("Error", err); } }; run();

Create the client.

const { TranscribeClient } = require("@aws-sdk/client-transcribe"); // Set the AWS Region. const REGION = "REGION"; //e.g. "us-east-1" // Create an Amazon Transcribe service client object. const transcribeClient = new TranscribeClient({ region: REGION }); export { transcribeClient };
Python
SDK for Python (Boto3)
Note

There's more on GitHub. Find the complete example and learn how to set up and run in the AWS Code Examples Repository.

def delete_job(job_name, transcribe_client): """ Deletes a transcription job. This also deletes the transcript associated with the job. :param job_name: The name of the job to delete. :param transcribe_client: The Boto3 Transcribe client. """ try: transcribe_client.delete_transcription_job(TranscriptionJobName=job_name) logger.info("Deleted job %s.", job_name) except ClientError: logger.exception("Couldn't delete job %s.", job_name) raise