The Amplify API category provides an interface for retrieving and persisting your model data. The API category comes with default built-in support for AWS AppSync. The Amplify CLI allows you to define your API and provision a GraphQL service with CRUD operations and real-time functionality.
## Goal
To setup and configure your application with Amplify API to save items in the backend.
## Prerequisites
import ios1 from "/src/fragments/lib/graphqlapi/ios/getting-started/10_preReq.mdx";
import android2 from "/src/fragments/lib/graphqlapi/android/getting-started/10_preReq.mdx";
import flutter3 from "/src/fragments/lib/graphqlapi/flutter/getting-started/10_preReq.mdx";
## Configure API
To start provisioning API resources in the backend, go to your project directory and **execute the command**:
```bash
amplify add api
```
Enter the following when prompted:
```console
? Please select from one of the below mentioned services:
`GraphQL`
# The part below will show you some options you can change, if you wish to change any of them you can navigate with
# your arrow keys and update any field, otherwise you can click on `Continue` to move on
? Here is the GraphQL API that we will create. Select a setting to edit or continue
`Continue`
? Choose a schema template:
`Single object with fields (e.g., “Todo” with ID, name, description)`
? Do you want to edit the schema now?
`No`
```
**Troubleshooting:** The AWS API plugins do not support conflict detection. If AppSync returns errors about missing `_version` and `_lastChangedAt` fields, or unhandled conflicts, disable **conflict detection**. Run `amplify update api`, and choose **Disable conflict detection**. If you started with the Getting Started guide, which introduces DataStore, this step is required.
The guided schema creation will output `amplify/backend/api/{api_name}/schema.graphql` containing the following:
```graphql
type Todo @model {
id: ID!
name: String!
description: String
}
```
To push your changes to the cloud, **execute the command**:
```bash
amplify push
```
import ios4 from "/src/fragments/lib/graphqlapi/ios/getting-started/12_amplifyConfig.mdx";
import android5 from "/src/fragments/lib/graphqlapi/android/getting-started/12_amplifyConfig.mdx";
import flutter6 from "/src/fragments/lib/graphqlapi/flutter/getting-started/12_amplifyConfig.mdx";
import ios7 from "/src/fragments/lib/graphqlapi/ios/getting-started/40_codegen.mdx";
import android8 from "/src/fragments/lib/graphqlapi/android/getting-started/40_codegen.mdx";
import flutter7 from "/src/fragments/lib/graphqlapi/flutter/getting-started/40_codegen.mdx";
## Install Amplify Libraries
import ios9 from "/src/fragments/lib/graphqlapi/ios/getting-started/20_installLib.mdx";
import android10 from "/src/fragments/lib/graphqlapi/android/getting-started/20_installLib.mdx";
import flutter11 from "/src/fragments/lib/graphqlapi/flutter/getting-started/20_installLib.mdx";
## Initialize Amplify API
import ios12 from "/src/fragments/lib/graphqlapi/ios/getting-started/30_initapi.mdx";
import android13 from "/src/fragments/lib/graphqlapi/android/getting-started/30_initapi.mdx";
import flutter14 from "/src/fragments/lib/graphqlapi/flutter/getting-started/30_initapi.mdx";
## Create a Todo
import ios15 from "/src/fragments/lib/graphqlapi/ios/getting-started/50_createtodo.mdx";
import android16 from "/src/fragments/lib/graphqlapi/android/getting-started/50_createtodo.mdx";
import flutter17 from "/src/fragments/lib/graphqlapi/flutter/getting-started/50_createtodo.mdx";
Upon successfully executing this code, you should see an instance of `todo` persisted in your dynamoDB table.
To navigate to your backend, run `amplify console api` and choose `GraphQL`. This will open the AppSync console to your GraphQL service. Select `Data Sources` and select the Resource link in your `TodoTable` to bring you to the DynamoDB Console. Select the `items` tab to see the `Todo` object that has been persisted in your database.
## Next steps
Congratulations! You've created a `Todo` object in your database. Check out the following links to see other Amplify API use cases:
* [Fetch data](/lib/graphqlapi/query-data)
* [Update data](/lib/graphqlapi/mutate-data)
* [Subscribe to data](/lib/graphqlapi/subscribe-data)
* [Concepts](/lib/graphqlapi/concepts)
* [Configure authorization modes](/lib/graphqlapi/authz)