# App Links & Universal Links Checker API

> Validate assetlinks.json and apple-app-site-association: HTTPS, no redirects, JSON shape, package / SHA-256 / app ID, and which paths open the app.

- Endpoint: `GET | POST https://apibox.io.vn/v1/app-links-check`
- Category: Web & SEO
- HTML docs: https://apibox.io.vn/docs/app-links-check/ (Vietnamese: https://apibox.io.vn/vi/docs/app-links-check/)
- Online tool: https://apibox.io.vn/tools/app-links-check/
- Authentication: `Authorization: Bearer <API key>` or `X-API-Key: <API key>` (free key: https://apibox.io.vn/dashboard/#signup)

Deep links silently fall back to the browser when the association files are wrong. Give a `domain` and the API fetches `https://<domain>/.well-known/assetlinks.json` (Android App Links) and `/.well-known/apple-app-site-association` plus the legacy root location (iOS Universal Links), then checks what the operating systems check: HTTPS, status 200, no redirects, `Content-Type: application/json`, size (AASA at most 128 KB) and valid JSON.

Android: each statement needs `relation` `delegate_permission/common.handle_all_urls` and a target with `namespace: android_app`, `package_name` and upper-case colon-separated SHA-256 certificate fingerprints. Pass `package` and `sha256` (colons optional) to confirm your app and signing key are listed (with Play App Signing, use the app signing key from Play Console). iOS: `applinks.details` with `appIDs` (Team ID + bundle ID) and `components` (iOS 13+) or legacy `paths`, plus `webcredentials` and `appclips`. Pass `app_id` (or `team_id` + `bundle_id`) and `paths` to see whether each URL opens the app: the matcher follows Apple's rules (`*`, `?`, `exclude`, query dictionaries, `#` fragments, `caseSensitive`, `percentEncoded`, `substitutionVariables` and `NOT` paths), first matching rule wins.

`cdn=1` also fetches Apple's CDN copy (app-site-association.cdn-apple.com), which devices actually use, and tells you whether it is still stale. You can validate files before deploying by posting `assetlinks` and / or `aasa` contents instead of a domain. When package, fingerprints or app IDs are given, the response includes a correct `suggested` file to copy.

## Parameters

| Name | In | Type | Required | Default | Description |
|---|---|---|---|---|---|
| `domain` | query | string | yes |  | Host to check (e.g. `www.example.com`; a URL is accepted). Not needed when `assetlinks` / `aasa` contents are sent. |
| `platform` | query | string | no | `both` | `android`, `ios` or `both`. |
| `package` | query | string | no |  | Android package name to look for, e.g. `vn.example.shop`. |
| `sha256` | query | string | no |  | SHA-256 signing certificate fingerprint(s), comma-separated; colons optional. |
| `app_id` | query | string | no |  | iOS app ID(s) `TEAMID.bundle.id` (or `team_id` + `bundle_id`). |
| `paths` | query | string | no |  | Paths or URLs to test against the AASA rules (comma-separated, max 50), e.g. `/product/123?ref=fb`. |
| `cdn` | query | boolean | no |  | `1`: also fetch Apple's CDN copy and compare it with your file. |
| `assetlinks` | body | object | no |  | assetlinks.json contents to validate offline (JSON or string). |
| `aasa` | body | object | no |  | apple-app-site-association contents to validate offline. |

## Example request

```bash
curl -X POST "https://apibox.io.vn/v1/app-links-check" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"platform":"ios","app_id":"ABCDE12345.vn.example.shop","paths":"/product/123,/admin/login","aasa":{"applinks":{"details":[{"appIDs":["ABCDE12345.vn.example.shop"],"components":[{"/":"/admin/*","exclude":true},{"/":"/product/*"}]}]}}}'
```

## Example response

```json
{
  "domain": "example.com",
  "ios": {
    "file": null,
    "app_ids": [
      "ABCDE12345.vn.example.shop"
    ],
    "webcredentials": [],
    "appclips": [],
    "match": [
      {
        "app_id": "ABCDE12345.vn.example.shop",
        "applinks": true,
        "webcredentials": false,
        "appclips": false
      }
    ],
    "paths": [
      {
        "path": "/product/123",
        "apps": [
          {
            "app_id": "ABCDE12345.vn.example.shop",
            "opens_app": true,
            "matched_rule": {
              "/": "/product/*"
            }
          }
        ]
      },
      {
        "path": "/admin/login",
        "apps": [
          {
            "app_id": "ABCDE12345.vn.example.shop",
            "opens_app": false,
            "matched_rule": {
              "/": "/admin/*",
              "exclude": true
            }
          }
        ]
      }
    ],
    "errors": 0,
    "warnings": 0,
    "valid": true,
    "issues": [],
    "suggested": {
      "applinks": {
        "details": [
          {
            "appIDs": [
              "ABCDE12345.vn.example.shop"
            ],
            "components": [
              {
                "/": "/product/123"
              },
              {
                "/": "/admin/login"
              }
            ]
          }
        ]
      },
      "webcredentials": {
        "apps": [
          "ABCDE12345.vn.example.shop"
        ]
      }
    }
  },
  "valid": true,
  "notes": [
    "Both files must be served over HTTPS with status 200, no redirects and Content-Type application/json; each subdomain needs its own files.",
    "…"
  ]
}
```

## Use cases

- Debug why a link opens the website instead of the app
- Check association files in CI before and after a deploy
- Confirm a new signing key or bundle ID is listed
- Test which marketing URLs will open the app on iOS

## FAQ

### Why does iOS still use my old file?

iOS downloads apple-app-site-association from Apple's CDN, not from your server. The CDN refreshes on its own schedule (often within a day); cdn=1 shows the copy it serves.

### Where are Android path rules?

In the intent filters of AndroidManifest.xml. assetlinks.json only proves that the domain trusts your app; each host in the intent filters needs its own file.

### Does a redirect from example.com to www break it?

Yes. Both platforms require the file at the exact host with status 200 and no redirect, so serve it on every host you link to.
