apple-app-site-association examples (and the errors that break them)
Copy-paste apple-app-site-association files for the cases teams actually need: exclusions, query parameters, several apps, staging builds and App Clips. Then the errors we see most, and how to fix each one.
The apple-app-site-association file (AASA for short) is a small JSON file that tells iOS which of your URLs should open your app. Most problems with it come down to a handful of patterns written slightly wrong, or a server that returns something other than the file.
This post is a reference: copy-paste examples for the cases teams actually need, then the errors we see most often and how to fix each one. For the full setup of both verification files (iOS and Android), start with our apple-app-site-association and assetlinks.json setup guide. If the file looks right and links still open Safari, the Universal Links debugging checklist covers the app side.
The parts of the file
Every example below uses the format Apple documents in Supporting associated domains: appIDs and components, supported since iOS 13.
{
"applinks": {
"details": [
{
"appIDs": ["ABCDE12345.com.example.shop"],
"components": [{ "/": "/*" }]
}
]
}
}
applinks.detailsis a list. Each entry says which apps (appIDs) handle which URLs (components).- An app ID is your 10-character Team ID, a dot, and the bundle ID:
ABCDE12345.com.example.shop. The Team ID is under Membership details on developer.apple.com. It isn't the numeric App Store ID. componentsare checked from top to bottom, and the first one that matches decides. A match on a component with"exclude": truekeeps the link in the browser.- Wildcards:
*matches zero or more characters,?matches exactly one character, and?*matches one or more.
The file is served at https://<your-domain>/.well-known/apple-app-site-association, with no .json extension, over HTTPS and with no redirects.
Prefer not to write it by hand? Our free apple-app-site-association and assetlinks.json generator builds the file from a form, with the exact file names, and the Universal Link validator tests a real URL against it.
Example 1: every URL opens the app
The simplest useful file. Every path on the domain opens the app when it's installed.
{
"applinks": {
"details": [
{
"appIDs": ["ABCDE12345.com.example.shop"],
"components": [{ "/": "*" }]
}
]
}
}
Use this on a domain that exists only for links, such as links.example.com. On your main website it's usually too broad: help pages, the login page and the checkout would all try to open the app.
Example 2: everything except some paths
Put the exclusions first, then the catch-all.
{
"applinks": {
"details": [
{
"appIDs": ["ABCDE12345.com.example.shop"],
"components": [
{ "/": "/account/*", "exclude": true, "comment": "Login and account pages stay on the web" },
{ "/": "/blog/*", "exclude": true, "comment": "Articles stay on the web" },
{ "/": "*" }
]
}
]
}
}
If the catch-all { "/": "*" } came first, it would match every URL and the exclusions would never be read. This ordering mistake is the most common one we see.
Example 3: only some paths
The opposite approach: list what should open the app, and nothing else does.
{
"applinks": {
"details": [
{
"appIDs": ["ABCDE12345.com.example.shop"],
"components": [
{ "/": "/product/*", "comment": "Product pages" },
{ "/": "/offer/*", "comment": "Campaign links" },
{ "/": "/invite/?*", "comment": "Referral links: /invite/ followed by a code" }
]
}
]
}
}
Two details:
/product/*matches/product/and/product/42, but not/productwithout the trailing slash, and not/products/42. Add{ "/": "/product" }if the bare path should open the app too./invite/?*needs at least one character after the slash, so a bare/invite/stays on the web.
Example 4: match on a query parameter
The ? key matches the query string. Give it a dictionary to match named parameters.
{
"applinks": {
"details": [
{
"appIDs": ["ABCDE12345.com.example.shop"],
"components": [
{ "/": "/search", "?": { "q": "?*" }, "comment": "Searches with a query open the app" },
{ "/": "/share/*", "?": { "source": "app" }, "comment": "Only links shared from the app" }
]
}
]
}
}
A component matches only when all its keys match: here both the path and the parameter. Test real URLs with extra parameters too, such as /search?q=shoes&page=2, before you rely on a query rule.
Example 5: production and staging apps
List every bundle ID that should open the links. The same rules then apply to all of them.
{
"applinks": {
"details": [
{
"appIDs": [
"ABCDE12345.com.example.shop",
"ABCDE12345.com.example.shop.staging",
"ABCDE12345.com.example.shop.dev"
],
"components": [{ "/": "*" }]
}
]
}
}
If you install the staging and production apps on the same phone, iOS has to pick one for a given link. Test each build on its own device, or give staging its own link domain.
Example 6: different apps for different paths
Two apps on one domain, such as a customer app and a partner app, each with its own section. Use two entries in details.
{
"applinks": {
"details": [
{
"appIDs": ["ABCDE12345.com.example.partner"],
"components": [{ "/": "/partner/*" }]
},
{
"appIDs": ["ABCDE12345.com.example.shop"],
"components": [
{ "/": "/partner/*", "exclude": true },
{ "/": "*" }
]
}
]
}
}
The exclude in the second entry keeps partner URLs away from the customer app when both are installed.
Example 7: case-insensitive paths
Paths are case-sensitive by default, so /Offer/DIWALI doesn't match /offer/*. If people type or print your links in mixed case, turn that off per component:
{ "/": "/offer/*", "caseSensitive": false }
Example 8: passwords and App Clips in the same file
The same file can carry other associated-domain services alongside applinks. webcredentials lets iOS offer saved passwords for your site in the app, and appclips associates an App Clip with the domain.
{
"applinks": {
"details": [
{
"appIDs": ["ABCDE12345.com.example.shop"],
"components": [{ "/": "*" }]
}
]
},
"webcredentials": {
"apps": ["ABCDE12345.com.example.shop"]
},
"appclips": {
"apps": ["ABCDE12345.com.example.shop.Clip"]
}
}
Each service also needs its own entitlement in the app (webcredentials: and appclips: entries next to applinks: in Associated Domains). Neither is needed for Universal Links.
Example 9: the old format, for very old iOS versions
You may still find files in the format used before iOS 13: appID (singular) and paths, with NOT for exclusions.
{
"applinks": {
"apps": [],
"details": [
{
"appID": "ABCDE12345.com.example.shop",
"paths": ["NOT /account/*", "*"]
}
]
}
}
You only need this if you still support iOS 12 or older. Don't mix the two formats in one entry; Apple advises against it. If you need both, keep a separate entry for each.
Common errors and how to fix them
Most AASA errors fail silently: iOS just opens the link in Safari. These are the ones we see most when checking domains, with what they look like and the fix.
| What you see | Usual cause | Fix |
|---|---|---|
| The URL returns your website's HTML with a 200 | A single-page app's fallback serves index.html for unknown paths |
Serve the real file before the fallback rule, and check the response body, not only the status |
| 301, 302 or 308 on the file | example.com redirects to www.example.com, or http to https with a trailing slash |
Serve the file directly on every host your app lists; exclude /.well-known/ from the redirect |
| 404 | The file is named apple-app-site-association.json, sits outside /.well-known/, or the folder wasn't deployed |
Use the exact name with no extension, in /.well-known/, and check the build output |
content-type: application/octet-stream or text/plain |
Servers guess the type from the extension, and this file has none | Set Content-Type: application/json for that path |
| JSON parse errors | Trailing commas, // comments, curly “smart” quotes from a word processor |
JSON has no comments: use the comment key. Run the file through jq . before you upload |
| Valid file, but some links open Safari | A catch-all before an exclude, or a pattern that doesn't match the real URL |
Reorder the components and test real URLs (below) |
| Valid file, but no link opens the app | Wrong Team ID, the numeric App Store ID used as the app ID, or a bundle ID that differs from the installed build | Copy the Team ID from Membership details and the bundle ID from Xcode |
| Works for you, fails for Apple | Bot protection, a firewall, geo-blocking or a login wall in front of /.well-known/ |
Let any IP and user agent read the file, then check Apple's CDN copy |
| Your server has the new file, devices still use the old one | Apple's CDN caches the file | Check the CDN copy, and use developer mode while testing |
A file that's too large is rarer but real: Apple's CDN ignores files over 128 KB. If you're excluding thousands of individual URLs, group them under a path prefix instead.
How to check a file in two minutes
1. The raw response, the way Apple fetches it:
curl -sI https://links.example.com/.well-known/apple-app-site-association
You want HTTP/2 200, content-type: application/json and no location: header.
2. That the body is valid JSON:
curl -s https://links.example.com/.well-known/apple-app-site-association | jq .
If jq prints an error, so would iOS. If it prints HTML, your fallback rule is answering.
3. What Apple's CDN has, since iOS 14 devices read the file from there rather than from your server:
curl -s https://app-site-association.cdn-apple.com/a/v1/links.example.com
4. A real URL against your rules. On a Mac, Apple's swcutil tests a URL against a downloaded file:
curl -s https://links.example.com/.well-known/apple-app-site-association -o aasa.json
sudo swcutil verify -d links.example.com -j ./aasa.json -u https://links.example.com/product/42
Or paste the URL into our Universal Link and App Link validator. It fetches the file without following redirects, checks the status, content type, size and JSON structure, tests your path against components (exclusions included) and compares your server's file with Apple's CDN copy.
Where to host the file
Hosting is where most "the file is right but it doesn't work" problems start: a redirect from the bare domain, a missing content type, a dot-folder that wasn't deployed. We wrote a separate guide on hosting /.well-known/ files on Vercel, Netlify, Nginx and Cloudflare, with the exact config for each.
If the domain only exists for links, you can skip hosting altogether. CodeOnAir AppLinks builds and serves the AASA file and assetlinks.json on every link domain from your app settings, adds links you mark "open in browser on iOS" to the exclusions, and checks the result for you. The steps are in the AppLink setup guide.
FAQ
Does apple-app-site-association need a .json extension?
No. The file is named apple-app-site-association with no extension and served at /.well-known/apple-app-site-association. Serve it with an application/json content type, since servers can't guess the type from a missing extension.
What's the difference between appID and appIDs?
appID with paths is the format from before iOS 13. appIDs with components is the current one, and it can list several apps in one entry. Use appIDs unless you still support iOS 12 or older.
How do I exclude a path from opening the app?
Add a component with "exclude": true above the rule that would otherwise match it, for example { "/": "/account/*", "exclude": true } before { "/": "*" }. Components are read top to bottom and the first match wins.
Can I put comments in an apple-app-site-association file?
Not as // or /* */: the file is JSON, and JSON has no comments. Each component accepts a comment key that iOS ignores, which is the place for notes.
Why does my file work in the browser but not on the iPhone?
Usually because the browser follows redirects and iOS doesn't, or because Apple's CDN still has an older copy or couldn't reach your server. Check the response with curl -sI, then the CDN copy at app-site-association.cdn-apple.com.
Examples checked on 15 November 2026 against Apple's "Supporting associated domains" documentation and the applinks components reference.