1. API map: what an API is, and which Shopify API to use when

Aap kis language mein padhna chahoge?

Which language do you want to learn in?

Code aur technical words English mein hi rahenge. Aap baad mein bhi language badal sakte ho.

Lesson 1

API map: what an API is, and which Shopify API to use when

Beginner 75 minutesAPI version 2026-10

You need before starting

  • Track 0, lesson 4 (how the web works)
  • Track 0, lesson 27 (JSON and fetch)
  • Track 1, lesson 1 (Shopify, Dev Dashboard and your dev store)

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

  1. You (the client) decide what you want.
  2. You read the menu (the documentation). It lists what you may order.
  3. You give your order (the request) to the waiter (the API).
  4. The kitchen (the server) makes it.
  5. The waiter brings back your dish (the response), or says why not.

Here is the same flow for Shopify:

How an API call travels
 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.

PartWhat it isRestaurant exampleShopify example
Address (URL, endpoint)Where the request goesWhich restaurant and which counterhttps://your-store.myshopify.com/admin/api/2026-10/graphql.json
MethodWhat kind of action"Show me" or "I order this"GET reads, POST sends data
HeadersExtra notes on the request"Table 4, member card 1234"Content-Type: application/json
BodyThe data you sendThe 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.

CodeNameRestaurant exampleWhen Shopify sends it
200OK"Here is your dish."The request worked
401Unauthorized"Sorry, I do not know you."The token is missing or wrong
404Not Found"We have no such counter."The address is wrong
429Too 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

  1. Open your dev store's Shopify admin from Track 1.
  2. Open a notes file. You will fill in a small table at the end.
  3. 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.

PartValue
MethodPOST
URLhttps://{{shop}}/admin/api/{{api_version}}/graphql.json
AuthenticationAccess token in the X-Shopify-Access-Token header
HeadersContent-Type: application/json, X-Shopify-Access-Token: (your token)
Required scopesNone for these two fields

{{shop}} means "your store address". {{api_version}} means 2026-10. Lesson 3 explains these placeholders.

Body of the request

Query
query ShopName {
  shop {
    name
    myshopifyDomain
  }
}

Variables: none.

Expected response: status 200 and the store name in JSON.

  1. Find the address. It ends with graphql.json.
  2. Find the method. It is POST.
  3. Find the token. It travels in a header.
  4. Find the body. It is the text that asks for name.
Check: You can point at the address, the method, the token header and the body above.

Step 2: Read the real response

This is the real answer from our course store.

Actual response

Output
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
      }
    }
  }
}
  1. Read the status: 200 OK. It worked.
  2. Read data. The shop is called sdev-app-developer.
  3. Notice extensions. It is the price of the question. Lesson 5 explains it.

Your store name, times and numbers will be different.

Cleanup: nothing.

Check: You can find the store name inside 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:

Output
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:

Output
Status: 404 Not Found (459 ms)
{
  "errors": "Not Found"
}
  1. Match 401 to the table in "What it is". The token was wrong.
  2. Match 404 to 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.

Check: You can say what 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.

APIWhat it doesWho uses itHow you authenticateWhere in this course
GraphQL Admin APIReads and changes store data: products, orders, customers, stockAppsAdmin access token in X-Shopify-Access-TokenPractised: this track, lessons 2 to 14. Track 2, lesson 13
REST Admin API (legacy)The older Admin API with one address per objectOld appsAdmin access tokenPractised: lesson 22 (compare only)
Storefront APIProducts, collections, search and carts for buyersHeadless stores, appsPublic or private storefront token, or none for some dataPractised: lessons 15 and 16. Track 3
Customer Account APIA logged-in buyer reads their own orders, profile and addressesHeadless storesBuyer logs in, then a token in AuthorizationPractised: lesson 17. Track 3, lesson 7
Cart Ajax APIChanges the cart from theme JavaScript without reloadThemesNone, it runs in the storePractised: Track 1, lesson 15. Lesson 18
Section Rendering APISends back fresh HTML of theme sectionsThemesNonePractised: Track 1, lesson 15. Lesson 18
WebhooksShopify sends your app a message when something happensAppsShopify signs each message; you check the signaturePractised: Track 2, lesson 14. Lesson 19
App ProxyA store address that Shopify forwards to your appAppsShopify signs each request; you check the signaturePractised: Track 2, lesson 21. Lesson 20
Shopify FunctionsYour logic runs inside Shopify, like discount rulesAppsNone: Shopify runs them, you do not call themPractised: Track 2, lesson 19. Introduced: lesson 21
Bulk queries and importsBig background jobs for thousands of itemsAppsAdmin access tokenPractised: lesson 23
Partner APIData from your partner account, like app installsPartnersPartner token in X-Shopify-Access-TokenPractised: lesson 24 (version 2026-07)
Payments Apps platform APILets approved payment companies process paymentsPayment companies onlyAdmin access token plus extra securityIntroduced 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.

Check: You can name the API for "a buyer reads their own past orders": the Customer Account API.

Step 5: Know the other APIs you will meet

These are introduced only. This track does not practise them.

NameWhat it isWhere you meet it
App BridgeLets an app inside the Shopify admin open admin pages and pop-upsTrack 2, lesson 12
UI extension APIsGive checkout, admin, customer account and POS extensions their dataTrack 2, lessons 18, 20 and 22
Web Pixels APILets apps listen to buyer events, like page_viewed, for analyticsNot taught. Read the Shopify docs
ShopifyQLA query language for store reports, run through the Admin APINot taught. Read the Shopify docs
LiquidShopify's template language for themes. It is not an APITrack 1, Module B
HydrogenA framework for headless stores, built on the Storefront APITrack 3
Check: You can say why Liquid is not an API: it builds theme pages, it does not answer requests.

Step 6: Ask three questions to pick an API

Use these three questions for any task.

  1. Ask "Who is acting?" An app for a merchant, a buyer, a logged-in buyer, or you as a partner.
  2. Ask "Where does the code run?" On a server, in a theme, or inside checkout.
  3. Ask "Does it read or change store data?" Changing store data needs the Admin API.
TaskAnswer
Change the price of 200 productsGraphQL Admin API
Show products in a phone appStorefront API
Add to cart on a theme page without reloadCart Ajax API
Check: You wrote the three questions in your notes file.

Output

  • You can name the parts of a request and a response.
  • You read a real 200, a real 401 and a real 404 from 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.

  1. A warehouse program lowers stock after a box is packed.
  2. A custom React shop shows the "Chai Corner" collection.
  3. A logged-in buyer changes their default address.
  4. A "Buy 2 teas, get 10% off" rule runs inside checkout.
  5. 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
  1. GraphQL Admin API. A server program changes store stock for the merchant.
  2. Storefront API. A custom shop shows products to buyers.
  3. Customer Account API. The buyer changes their own data after login.
  4. Shopify Functions. Shopify runs the discount logic inside checkout.
  5. Cart Ajax API. Theme JavaScript changes the cart without a reload.
Check: All 5 of your answers match the solution, and each has a reason.

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.
  • 200 worked, 401 bad token, 404 wrong address, 429 too 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 uses 2026-07.