Lesson 1
API map: what an API is, and which Shopify API to use when
What you will learn
- What an API is and how it works, from zero.
- The parts of a request: address, method, headers and body.
- The parts of a response: status code and JSON body.
- What a token is and why APIs need one.
- Every Shopify API, who uses it, and where this course teaches it.
- How to pick the right API for a task.
What it is
An API in one sentence
An API is a fixed way for one program to ask another program for data or for an action.
Think of a restaurant. You are hungry, but you cannot walk into the kitchen. You tell the waiter. The waiter tells the kitchen. The waiter brings your food back. The waiter is the API.
How it works
- You (the client) decide what you want.
- You read the menu (the documentation). It lists what you may order.
- You give your order (the request) to the waiter (the API).
- The kitchen (the server) makes it.
- The waiter brings back your dish (the response), or says why not.
Here is the same flow for Shopify:
YOU (client) SHOPIFY (server)
Postman, an app, a script
| |
| 1. REQUEST |
| address + method + headers + body |
| ----------------------------------> |
| | 2. Shopify checks your token,
| | reads or changes store data
| 3. RESPONSE |
| status code + JSON body |
| <---------------------------------- |
| |The parts of a request
A request is your order. It has four parts.
| Part | What it is | Restaurant example | Shopify example |
|---|---|---|---|
| Address (URL, endpoint) | Where the request goes | Which restaurant and which counter | https://your-store.myshopify.com/admin/api/2026-10/graphql.json |
| Method | What kind of action | "Show me" or "I order this" | GET reads, POST sends data |
| Headers | Extra notes on the request | "Table 4, member card 1234" | Content-Type: application/json |
| Body | The data you send | The order slip itself | {"query": "query { shop { name } }"} |
An endpoint is one address of an API. You met it in Track 0.
A method says what kind of action you want.
GET asks to read. POST sends data to the server.
Every Shopify GraphQL request uses POST.
Headers are short notes sent with a request, as name: value pairs.
Think of the sticky note on an order: "No onions. Table 4."
The body is the main data you send. Think of the order slip itself.
The parts of a response
A response is your dish. It has two main parts.
A status code is a number that says how it went. You met it in Track 0.
| Code | Name | Restaurant example | When Shopify sends it |
|---|---|---|---|
200 | OK | "Here is your dish." | The request worked |
401 | Unauthorized | "Sorry, I do not know you." | The token is missing or wrong |
404 | Not Found | "We have no such counter." | The address is wrong |
429 | Too Many Requests | "Slow down, the kitchen is full." | You sent too many requests too fast |
The response body holds the data, usually as JSON.
JSON is text that stores data as names and values, like "name": "Chai Corner".
Tokens and keys
A token is a secret string that proves who you are. Think of a hotel key card. It opens your room and the gym, but not the kitchen. Shopify calls it an access token. You send it in a header on every request. Never share it. Anyone with it can act as you.
An access scope is one permission inside a token, like read_products.
Think of the floors printed on the key card.
Words you need for the map
An app is a program that adds features to Shopify. Think of an app on your phone. It adds a new job to the phone.
GraphQL is a way to ask an API for exactly the fields you want. Think of a food order where you list each item. You get only what you listed. Lesson 2 teaches it.
A webhook is a message Shopify sends to your app when something happens. Think of a doorbell. You do not keep checking the door. The bell tells you.
A headless store is a shop website built outside Shopify themes. It still uses Shopify for products, cart and checkout. Think of a restaurant that sells its food through a food truck.
Why you need it
- Every lesson in this track sends requests. You must read each part.
- Picking the wrong API wastes days. A buyer cannot use the Admin API.
- Each API has its own address, its own token and its own rules.
- Clients describe a goal, not an API. You turn the goal into the right API.
Before you start
- Open your dev store's Shopify admin from Track 1.
- Open a notes file. You will fill in a small table at the end.
- Keep this lesson open next to it.
Steps
Step 1: Read a real request
Here is one real request to Shopify. It asks for the store's name. You will send this exact request yourself in lesson 3.
| Part | Value |
|---|---|
| Method | POST |
| URL | https://{{shop}}/admin/api/{{api_version}}/graphql.json |
| Authentication | Access token in the X-Shopify-Access-Token header |
| Headers | Content-Type: application/json, X-Shopify-Access-Token: (your token) |
| Required scopes | None for these two fields |
{{shop}} means "your store address". {{api_version}} means 2026-10.
Lesson 3 explains these placeholders.
Body of the request
query ShopName {
shop {
name
myshopifyDomain
}
}Variables: none.
Expected response: status 200 and the store name in JSON.
- Find the address. It ends with
graphql.json. - Find the method. It is
POST. - Find the token. It travels in a header.
- Find the body. It is the text that asks for
name.
Step 2: Read the real response
This is the real answer from our course store.
Actual response
Status: 200 OK (691 ms)
{
"data": {
"shop": {
"name": "sdev-app-developer",
"myshopifyDomain": "sdev-app-developer.myshopify.com"
}
},
"extensions": {
"cost": {
"requestedQueryCost": 1,
"actualQueryCost": 1,
"throttleStatus": {
"maximumAvailable": 2000,
"currentlyAvailable": 1999,
"restoreRate": 100
}
}
}
}- Read the status:
200 OK. It worked. - Read
data. The shop is calledsdev-app-developer. - Notice
extensions. It is the price of the question. Lesson 5 explains it.
Your store name, times and numbers will be different.
Cleanup: nothing.
data in the output above.Step 3: Read two real error responses
Mistakes are normal. The status code tells you what went wrong. We sent the same request twice more, each with one mistake.
First, a wrong token:
Status: 401 Unauthorized (475 ms)
{
"errors": "[API] Invalid API key or access token (unrecognized login or wrong password)"
}Second, a version that does not exist, 2026-13, in the address:
Status: 404 Not Found (459 ms)
{
"errors": "Not Found"
}- Match
401to the table in "What it is". The token was wrong. - Match
404to the table. The address was wrong.
429 means you sent too many requests too fast.
We do not cause it on purpose. Lesson 5 shows how to avoid it.
200, 401, 404 and 429 mean in one short sentence each.Step 4: Read the map of Shopify APIs
Shopify has many APIs. Each one is a door for a different visitor. "Practised" means you send real requests in this course. "Introduced" means you learn what it is, but do not build with it here.
| API | What it does | Who uses it | How you authenticate | Where in this course |
|---|---|---|---|---|
| GraphQL Admin API | Reads and changes store data: products, orders, customers, stock | Apps | Admin access token in X-Shopify-Access-Token | Practised: this track, lessons 2 to 14. Track 2, lesson 13 |
| REST Admin API (legacy) | The older Admin API with one address per object | Old apps | Admin access token | Practised: lesson 22 (compare only) |
| Storefront API | Products, collections, search and carts for buyers | Headless stores, apps | Public or private storefront token, or none for some data | Practised: lessons 15 and 16. Track 3 |
| Customer Account API | A logged-in buyer reads their own orders, profile and addresses | Headless stores | Buyer logs in, then a token in Authorization | Practised: lesson 17. Track 3, lesson 7 |
| Cart Ajax API | Changes the cart from theme JavaScript without reload | Themes | None, it runs in the store | Practised: Track 1, lesson 15. Lesson 18 |
| Section Rendering API | Sends back fresh HTML of theme sections | Themes | None | Practised: Track 1, lesson 15. Lesson 18 |
| Webhooks | Shopify sends your app a message when something happens | Apps | Shopify signs each message; you check the signature | Practised: Track 2, lesson 14. Lesson 19 |
| App Proxy | A store address that Shopify forwards to your app | Apps | Shopify signs each request; you check the signature | Practised: Track 2, lesson 21. Lesson 20 |
| Shopify Functions | Your logic runs inside Shopify, like discount rules | Apps | None: Shopify runs them, you do not call them | Practised: Track 2, lesson 19. Introduced: lesson 21 |
| Bulk queries and imports | Big background jobs for thousands of items | Apps | Admin access token | Practised: lesson 23 |
| Partner API | Data from your partner account, like app installs | Partners | Partner token in X-Shopify-Access-Token | Practised: lesson 24 (version 2026-07) |
| Payments Apps platform API | Lets approved payment companies process payments | Payment companies only | Admin access token plus extra security | Introduced only: lesson 25 |
The full name of the first row is the GraphQL Admin API. People also call it the Admin API.
The Storefront API is the GraphQL API for shopping. Think of the hotel lobby. Guests walk in and look around.
The Customer Account API is the GraphQL API for a logged-in buyer. Think of a guest's own room. Only that guest's key opens it.
The REST Admin API is the older Admin API. It is legacy since October 1, 2024. New public apps must use GraphQL only since April 1, 2025.
Step 5: Know the other APIs you will meet
These are introduced only. This track does not practise them.
| Name | What it is | Where you meet it |
|---|---|---|
| App Bridge | Lets an app inside the Shopify admin open admin pages and pop-ups | Track 2, lesson 12 |
| UI extension APIs | Give checkout, admin, customer account and POS extensions their data | Track 2, lessons 18, 20 and 22 |
| Web Pixels API | Lets apps listen to buyer events, like page_viewed, for analytics | Not taught. Read the Shopify docs |
| ShopifyQL | A query language for store reports, run through the Admin API | Not taught. Read the Shopify docs |
| Liquid | Shopify's template language for themes. It is not an API | Track 1, Module B |
| Hydrogen | A framework for headless stores, built on the Storefront API | Track 3 |
Step 6: Ask three questions to pick an API
Use these three questions for any task.
- Ask "Who is acting?" An app for a merchant, a buyer, a logged-in buyer, or you as a partner.
- Ask "Where does the code run?" On a server, in a theme, or inside checkout.
- Ask "Does it read or change store data?" Changing store data needs the Admin API.
| Task | Answer |
|---|---|
| Change the price of 200 products | GraphQL Admin API |
| Show products in a phone app | Storefront API |
| Add to cart on a theme page without reload | Cart Ajax API |
Output
- You can name the parts of a request and a response.
- You read a real
200, a real401and a real404from Shopify. - Your notes hold the API map and the three questions.
Common errors
Using the Admin API from a theme or a browser
Why: The Admin API needs a secret access token. Anyone can read code in a browser.
Fix: Keep Admin API calls on a server. In a theme, use the Cart Ajax API or the Storefront API.
Choosing the REST Admin API for a new app
Why: Old blog posts show REST examples. REST is legacy now.
Fix: Use the GraphQL Admin API.
Thinking 200 always means success
Why: GraphQL APIs can answer 200 OK and still send an errors list.
Fix: Always read the response body, not only the status code. Lesson 6 shows examples.
Looking for a Shopify Functions address
Why: Functions are not called with a request. Shopify runs them.
Fix: Build them inside an app. Lesson 21 shows how they run.
Try it yourself
Practice task
Task: Pick the right API for these 5 tasks. Give one reason for each.
- A warehouse program lowers stock after a box is packed.
- A custom React shop shows the "Chai Corner" collection.
- A logged-in buyer changes their default address.
- A "Buy 2 teas, get 10% off" rule runs inside checkout.
- A theme's cart drawer updates the quantity of a line.
Hints:
- Ask the three questions from step 6 for each task.
- "Logged-in buyer" points to one API only.
- Logic "inside checkout" is not a request.
Expected result: Five answers, one API name each, with one short reason each.
Show solution
- GraphQL Admin API. A server program changes store stock for the merchant.
- Storefront API. A custom shop shows products to buyers.
- Customer Account API. The buyer changes their own data after login.
- Shopify Functions. Shopify runs the discount logic inside checkout.
- Cart Ajax API. Theme JavaScript changes the cart without a reload.
Quick recap
- An API is a waiter between you and a server.
- A request has an address, a method, headers and a body.
- A response has a status code and a body, usually JSON.
200worked,401bad token,404wrong address,429too fast.- A token is a secret key card. Send it in a header. Never share it.
- The GraphQL Admin API changes store data. The Storefront API is for shopping.
- This course uses version
2026-10. The Partner API uses2026-07.