Name:
interface
Value:
Extend your Amplify Gen 2 app with AWS Blocks — self-contained backend capabilities you compose into your existing backend.

Page updated Apr 29, 2024

NewDeploy web apps with Git or your AI coding agent using the latest AWS Amplify. Add managed databases and authentication as you grow. Explore the documentation.
Maintenance ModeYou are viewing Amplify Gen 1 documentation. Amplify Gen 1 has entered maintenance mode and will reach end of life on May 1, 2027. For existing Gen 1 projects, a migration guide and tooling are available to help you upgrade.
JavaScript v5Amplify JavaScript v5 has entered maintenance mode. We recommend upgrading to v6. A migration guide is available to help you upgrade from v5 to v6.

Delete data

These docs cover Amplify Gen 1. For new web apps, we recommend the latest AWS Amplify, with a simplified CLI and native integrations for databases, storage, and AI models. Get started with the latest AWS Amplify.

DELETE data

const apiName = 'MyApiName'; // replace this with your api name.
const path = '/path'; //replace this with the path you have configured on your API
const myInit = {
headers: {} // OPTIONAL
};
API.del(apiName, path, myInit)
.then((response) => {
// Add your code here
})
.catch((error) => {
console.log(error.response);
});

Example with async/await

async function deleteData() {
const apiName = 'MyApiName';
const path = '/path';
const myInit = {
headers: {} // OPTIONAL
};
return await API.del(apiName, path, myInit);
}
deleteData();

Access body in the Lambda function

// using a basic lambda handler
exports.handler = (event, context) => {
console.log('body: ', event.body);
};
// using serverless express
app.delete('/myendpoint', function (req, res) {
console.log('body: ', req.body);
});