Amplify has re-imagined the way frontend developers build fullstack applications. Develop and deploy without the hassle.

Page updated May 7, 2024

Set up Amplify REST API

Amplify Flutter v1 is now in Maintenance Mode until April 30th, 2025. This means that we will continue to include updates to ensure compatibility with backend services and security. No new features will be introduced in v1.

Please use the latest version (v2) of Amplify Flutter to get started.

If you are currently using v1, follow these instructions to upgrade to v2.

The Amplify API category provides an interface for making requests to your backend. The Amplify CLI deploys REST APIs and handlers using Amazon API Gateway and AWS Lambda.


To setup and configure your application with Amplify API to make requests to your API Gateway and trigger the lambda function using authorization provided by Amplify Auth.


Amplify Flutter requires a minimum target platform for iOS (13.0), Android (API level 24), and macOS (10.15). Additional setup is required for some target platforms. Please see the platform setup guide for more details on platform specific setup.

Configure API

To start provisioning API resources in the backend, go to your project directory and execute the command:

amplify add api

Enter the following when prompted:

? Please select from one of the below mentioned services:
? Provide a friendly name for your resource to be used as a label for this category in the project:
? Provide a path (e.g., /book/{isbn}):
? Choose a Lambda source
`Create a new Lambda function`
? Provide a friendly name for your resource to be used as a label for this category in the project:
? Provide the AWS Lambda function name:
? Choose the function runtime that you want to use:
? Choose the function template that you want to use:
`Serverless ExpressJS function (Integration with API Gateway)`
? Do you want to access other resources created in this project from your Lambda function?
? Do you want to invoke this function on a recurring schedule?
? Do you want to edit the local lambda function now?
? Restrict API access
? Do you want to add another path?

To push your changes to the cloud, execute the command:

amplify push

Upon completion, amplifyconfiguration.dart should be updated to reference provisioned backend storage resources. Note that this file should already be a part of your project if you followed the Project setup walkthrough.

Install Amplify Libraries

Add the following dependencies to your pubspec.yaml file and install dependencies when asked. Please keep in mind that Auth plugin is needed for IAM authorization mode, which is default for REST API:

sdk: flutter
amplify_flutter: ^1.0.0
amplify_api: ^1.0.0
amplify_auth_cognito: ^1.0.0

Initialize Amplify API

To initialize the Amplify API category you call Amplify.addPlugin() method. To complete initialization call Amplify.configure().

Your code should look like this:

import 'package:amplify_flutter/amplify_flutter.dart';
import 'package:amplify_api/amplify_api.dart';
import 'package:amplify_auth_cognito/amplify_auth_cognito.dart';
import 'package:flutter/material.dart';
import 'amplifyconfiguration.dart';
void main() {
class MyApp extends StatefulWidget {
_MyAppState createState() => _MyAppState();
class _MyAppState extends State<MyApp> {
void initState() {
Future<void> _configureAmplify() async {
// Add the following line to add API plugin to your app.
// Auth plugin needed for IAM authorization mode, which is default for REST API.
final auth = AmplifyAuthCognito();
final api = AmplifyAPI();
await Amplify.addPlugins([api, auth]);
try {
await Amplify.configure(amplifyconfig);
} on AmplifyAlreadyConfiguredException {
'Tried to reconfigure Amplify; this can occur when your app restarts on Android.');
Future<void> onTestApi() async {
// Edit this function with next steps.
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: Padding(
padding: const EdgeInsets.all(20.0),
child: ElevatedButton(
onPressed: onTestApi,
child: const Text('Rest API'),

Make a POST Request

Send a POST request with a JSON body.

Future<void> postTodo() async {
try {
final restOperation =
body: HttpPayload.json({'name': 'Mow the lawn'}),
final response = await restOperation.response;
print('POST call succeeded');
} on ApiException catch (e) {
print('POST call failed: $e');

To navigate to your backend, go to the API Gateway console and select the API. The name of the API corresponds to the friendly name of the resource to be used as a label you specified earlier in the CLI steps.

Next steps

Congratulations! You've made a call to your API Gateway and triggered your Lambda function. Check out the following links to see other Amplify API use cases: