{
  "openapi": "3.1.0",
  "info": {
    "title": "AppPortal public Smart Links",
    "version": "v1",
    "description": "Public approved-host resolution, native association documents, browser redirects and instrumented web landing confirmation. Dashboard management and OAuth agent tools are separate."
  },
  "servers": [
    {
      "url": "https://{appHost}",
      "description": "Replace the reserved example with the ready approved app/environment host shown in Dashboard. A caller-selected Host value is not approval or management authorization.",
      "variables": {
        "appHost": {
          "default": "example.invalid",
          "description": "Your approved app/environment host, not a global resolver host. Custom domains require the applicable agreement."
        }
      }
    }
  ],
  "x-appportal-public-authentication": "Public reads require no account credential. Landing confirmation uses a separate host-bound body capability; read that operation before sending it.",
  "security": [],
  "paths": {
    "/.well-known/apple-app-site-association": {
      "get": {
        "summary": "Read Apple Universal Link association",
        "security": [],
        "description": "Only registered valid native identities for this host are returned. Apple and Android consume different JSON shapes. Android 15+ dynamic components cannot expand an older Android manifest's static scope.",
        "responses": {
          "200": {
            "description": "Exact native association identities for this active host. Never redirects.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppleAppSiteAssociation"
                },
                "example": {
                  "applinks": {
                    "details": [
                      {
                        "appIDs": [
                          "ABCDE12345.com.example.northwind"
                        ],
                        "components": [
                          {
                            "/": "/*"
                          }
                        ]
                      }
                    ]
                  }
                }
              }
            }
          },
          "404": {
            "description": "No active host owner or valid identity for this platform. The association document does not redirect to a fallback."
          },
          "502": {
            "description": "Generated by the managed edge when it cannot obtain an origin response. A landing confirmation may already have reached the origin. The edge sends it once. An actual origin error keeps its native response.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              },
              "X-AppPortal-TraceId": {
                "schema": {
                  "type": "string",
                  "pattern": "^[a-f0-9]{32}$"
                }
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/SmartLinkEdgeProblem"
                }
              }
            }
          }
        }
      }
    },
    "/.well-known/assetlinks.json": {
      "get": {
        "summary": "Read Android App Link association",
        "security": [],
        "description": "Only registered valid native identities for this host are returned. Apple and Android consume different JSON shapes. Android 15+ dynamic components cannot expand an older Android manifest's static scope.",
        "responses": {
          "200": {
            "description": "Exact native association identities for this active host. Never redirects.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AndroidAssetLinks"
                },
                "example": [
                  {
                    "relation": [
                      "delegate_permission/common.handle_all_urls"
                    ],
                    "target": {
                      "namespace": "android_app",
                      "package_name": "com.example.northwind",
                      "sha256_cert_fingerprints": [
                        "AB:AB:AB:AB:AB:AB:AB:AB:AB:AB:AB:AB:AB:AB:AB:AB:AB:AB:AB:AB:AB:AB:AB:AB:AB:AB:AB:AB:AB:AB:AB:AB"
                      ]
                    },
                    "relation_extensions": {
                      "delegate_permission/common.handle_all_urls": {
                        "dynamic_app_link_components": [
                          {
                            "/": "/*"
                          }
                        ]
                      }
                    }
                  }
                ]
              }
            }
          },
          "404": {
            "description": "No active host owner or valid identity for this platform. The association document does not redirect to a fallback."
          },
          "502": {
            "description": "Generated by the managed edge when it cannot obtain an origin response. A landing confirmation may already have reached the origin. The edge sends it once. An actual origin error keeps its native response.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              },
              "X-AppPortal-TraceId": {
                "schema": {
                  "type": "string",
                  "pattern": "^[a-f0-9]{32}$"
                }
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/SmartLinkEdgeProblem"
                }
              }
            }
          }
        }
      }
    },
    "/": {
      "get": {
        "summary": "Redirect to the host fallback",
        "security": [],
        "description": "An active approved host uses its configured fallback. Unknown or inactive ownership uses the platform fallback. No installed-app state is inferred.",
        "responses": {
          "302": {
            "description": "Temporary redirect to the selected configured destination. Automatic clients should inspect Location without assuming the destination loaded.",
            "headers": {
              "Location": {
                "required": true,
                "schema": {
                  "type": "string",
                  "format": "uri"
                }
              }
            }
          },
          "502": {
            "description": "Generated by the managed edge when it cannot obtain an origin response. A landing confirmation may already have reached the origin. The edge sends it once. An actual origin error keeps its native response.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              },
              "X-AppPortal-TraceId": {
                "schema": {
                  "type": "string",
                  "pattern": "^[a-f0-9]{32}$"
                }
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/SmartLinkEdgeProblem"
                }
              }
            }
          }
        }
      }
    },
    "/{slug}": {
      "get": {
        "summary": "Open a public Smart Link in the browser",
        "security": [],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "The link slug within this host's approved app/environment binding."
          }
        ],
        "description": "If the OS did not intercept the URL, select the configured platform store or web fallback. Missing, inactive or expired links redirect to the applicable host/platform fallback. User-agent classification is not install detection or proof of a person. Redirect issuance does not prove a landing, app route or conversion.",
        "responses": {
          "302": {
            "description": "Temporary redirect to the selected configured destination. Automatic clients should inspect Location without assuming the destination loaded.",
            "headers": {
              "Location": {
                "required": true,
                "schema": {
                  "type": "string",
                  "format": "uri"
                }
              }
            }
          },
          "502": {
            "description": "Generated by the managed edge when it cannot obtain an origin response. A landing confirmation may already have reached the origin. The edge sends it once. An actual origin error keeps its native response.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              },
              "X-AppPortal-TraceId": {
                "schema": {
                  "type": "string",
                  "pattern": "^[a-f0-9]{32}$"
                }
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/SmartLinkEdgeProblem"
                }
              }
            }
          }
        }
      }
    },
    "/_appportal/resolve/{slug}": {
      "get": {
        "summary": "Resolve the installed-app destination",
        "security": [],
        "description": "Resolve an active, unexpired link within the exact active app/environment host binding. The caller's platform hint selects a configured destination; a response does not prove the app opened or accepted the route. This read grants no management authority.",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "The link slug within this host's approved app/environment binding."
          },
          {
            "name": "platform",
            "in": "query",
            "required": false,
            "description": "Optional ios or android, case-insensitive with surrounding whitespace trimmed. Omitted or whitespace uses the default app destination. Other nonempty values return 400.",
            "schema": {
              "type": "string",
              "pattern": "^\\s*(?:[iI][oO][sS]|[aA][nN][dD][rR][oO][iI][dD])?\\s*$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Configured app destination and attribution coordinates; these are routing evidence, not install/user/conversion proof.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SmartLinkResolution"
                }
              }
            }
          },
          "400": {
            "description": "A nonempty platform value is unsupported."
          },
          "404": {
            "description": "No active host binding, matching active app scope, available unexpired link or applicable app destination."
          },
          "502": {
            "description": "Generated by the managed edge when it cannot obtain an origin response. A landing confirmation may already have reached the origin. The edge sends it once. An actual origin error keeps its native response.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              },
              "X-AppPortal-TraceId": {
                "schema": {
                  "type": "string",
                  "pattern": "^[a-f0-9]{32}$"
                }
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/SmartLinkEdgeProblem"
                }
              }
            }
          }
        }
      }
    },
    "/_appportal/landing": {
      "post": {
        "summary": "Confirm an instrumented web landing",
        "security": [],
        "description": "Submit the separate opaque confirmationId from the redirect fragment in a JSON body, never in a URL or log. The stored web redirect and exact public host bind this capability. Replays are idempotent. The public result does not reveal whether confirmation changed stored evidence. No account, SDK or management permission is granted, and this request does not establish consent or a human identity.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SmartLinkLandingConfirmationRequest"
              }
            }
          }
        },
        "responses": {
          "204": {
            "description": "No response body. Identical for a valid, replayed, unknown, invalid or cross-host confirmation capability.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              },
              "Access-Control-Allow-Origin": {
                "schema": {
                  "type": "string",
                  "const": "*"
                }
              },
              "Access-Control-Allow-Methods": {
                "schema": {
                  "type": "string",
                  "const": "POST, OPTIONS"
                }
              },
              "Access-Control-Allow-Headers": {
                "schema": {
                  "type": "string",
                  "const": "Content-Type"
                }
              }
            }
          },
          "400": {
            "description": "Malformed JSON, missing/non-object/null body, or an invalid JSON value/type. This is distinct from an unknown well-formed confirmationId."
          },
          "415": {
            "description": "The required JSON content type is unsupported."
          },
          "502": {
            "description": "Generated by the managed edge when it cannot obtain an origin response. A landing confirmation may already have reached the origin. The edge sends it once. An actual origin error keeps its native response.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              },
              "X-AppPortal-TraceId": {
                "schema": {
                  "type": "string",
                  "pattern": "^[a-f0-9]{32}$"
                }
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/SmartLinkEdgeProblem"
                }
              }
            }
          }
        },
        "x-appportal-capability": "confirmationId is accepted only as a body capability for a previously stored web redirect on this host. The current store defines no separate time-based capability TTL; link expiry and record retention are separate controls."
      },
      "options": {
        "summary": "Read landing confirmation CORS preflight",
        "security": [],
        "responses": {
          "204": {
            "description": "No response body. Identical for a valid, replayed, unknown, invalid or cross-host confirmation capability.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              },
              "Access-Control-Allow-Origin": {
                "schema": {
                  "type": "string",
                  "const": "*"
                }
              },
              "Access-Control-Allow-Methods": {
                "schema": {
                  "type": "string",
                  "const": "POST, OPTIONS"
                }
              },
              "Access-Control-Allow-Headers": {
                "schema": {
                  "type": "string",
                  "const": "Content-Type"
                }
              }
            }
          },
          "502": {
            "description": "Generated by the managed edge when it cannot obtain an origin response. A landing confirmation may already have reached the origin. The edge sends it once. An actual origin error keeps its native response.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              },
              "X-AppPortal-TraceId": {
                "schema": {
                  "type": "string",
                  "pattern": "^[a-f0-9]{32}$"
                }
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/SmartLinkEdgeProblem"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "SmartLinkResolution": {
        "type": [
          "object",
          "null"
        ],
        "properties": {
          "attributionId": {
            "type": "string"
          },
          "linkId": {
            "type": "string"
          },
          "slug": {
            "type": "string"
          },
          "publicUrl": {
            "type": "string"
          },
          "deepLinkUrl": {
            "type": "string"
          },
          "fallbackUrl": {
            "type": "string"
          },
          "expiresAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "campaign": {
            "type": [
              "string",
              "null"
            ]
          },
          "source": {
            "type": [
              "string",
              "null"
            ]
          },
          "medium": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "attributionId",
          "linkId",
          "slug",
          "publicUrl",
          "deepLinkUrl",
          "fallbackUrl",
          "expiresAt",
          "campaign",
          "source",
          "medium"
        ]
      },
      "SmartLinkLandingConfirmationRequest": {
        "type": "object",
        "properties": {
          "confirmationId": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "description": "The opaque confirmationId is a single-purpose body capability from the web redirect fragment. Unknown, invalid, replayed and cross-host values receive the same 204 response. It is not the public attributionId."
      },
      "AppleAppSiteAssociation": {
        "type": "object",
        "properties": {
          "applinks": {
            "type": "object",
            "properties": {
              "details": {
                "type": "array",
                "minItems": 1,
                "maxItems": 1,
                "items": {
                  "type": "object",
                  "properties": {
                    "appIDs": {
                      "type": "array",
                      "minItems": 1,
                      "items": {
                        "type": "string"
                      }
                    },
                    "components": {
                      "type": "array",
                      "minItems": 1,
                      "maxItems": 1,
                      "items": {
                        "type": "object",
                        "properties": {
                          "/": {
                            "const": "/*"
                          }
                        },
                        "required": [
                          "/"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "appIDs",
                    "components"
                  ],
                  "additionalProperties": false
                }
              }
            },
            "required": [
              "details"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "applinks"
        ],
        "additionalProperties": false
      },
      "AndroidAssetLinks": {
        "type": "array",
        "minItems": 1,
        "items": {
          "type": "object",
          "properties": {
            "relation": {
              "type": "array",
              "minItems": 1,
              "maxItems": 1,
              "items": {
                "const": "delegate_permission/common.handle_all_urls"
              }
            },
            "target": {
              "type": "object",
              "properties": {
                "namespace": {
                  "const": "android_app"
                },
                "package_name": {
                  "type": "string"
                },
                "sha256_cert_fingerprints": {
                  "type": "array",
                  "minItems": 1,
                  "items": {
                    "type": "string"
                  }
                }
              },
              "required": [
                "namespace",
                "package_name",
                "sha256_cert_fingerprints"
              ],
              "additionalProperties": false
            },
            "relation_extensions": {
              "type": "object",
              "properties": {
                "delegate_permission/common.handle_all_urls": {
                  "type": "object",
                  "properties": {
                    "dynamic_app_link_components": {
                      "type": "array",
                      "minItems": 1,
                      "maxItems": 1,
                      "items": {
                        "type": "object",
                        "properties": {
                          "/": {
                            "const": "/*"
                          }
                        },
                        "required": [
                          "/"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "dynamic_app_link_components"
                  ],
                  "additionalProperties": false
                }
              },
              "required": [
                "delegate_permission/common.handle_all_urls"
              ],
              "additionalProperties": false
            }
          },
          "required": [
            "relation",
            "target",
            "relation_extensions"
          ],
          "additionalProperties": false
        }
      },
      "SmartLinkEdgeProblem": {
        "type": "object",
        "properties": {
          "type": {
            "const": "https://appportal.io/problems/upstream_unavailable"
          },
          "title": {
            "const": "Bad Gateway"
          },
          "status": {
            "const": 502
          },
          "code": {
            "const": "upstream_unavailable"
          },
          "detail": {
            "type": "string"
          },
          "message": {
            "type": "string"
          },
          "error": {
            "type": "string"
          },
          "traceId": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$"
          },
          "instance": {
            "type": "string",
            "pattern": "^urn:appportal:request:[a-f0-9]{32}$"
          }
        },
        "required": [
          "type",
          "title",
          "status",
          "code",
          "detail",
          "message",
          "error",
          "traceId",
          "instance"
        ],
        "additionalProperties": false
      }
    }
  },
  "x-appportal-source": "src/AppPortal.Links.Api/Program.cs; pure native association builder; actual Contracts DTOs",
  "x-appportal-edge-boundary": "The existing managed-domain edge forwards GET/HEAD and landing POST/OPTIONS to the origin, strips caller-supplied X-AppPortal-Smart-Link-Host, and forwards its governed host. The origin trusts that forwarded value only from its configured edge worker zone. No management routes are exposed here.",
  "x-appportal-scope": "Public resolution and confirmation only. Neither a redirect nor resolution proves an installation, identity, conversion, accepted app route or consent decision. Native OS association handling remains a separate device validation.",
  "x-appportal-property-names-case-insensitive": true,
  "x-appportal-reference-source": "8bda8e8302d4ea5bd005ef1132f7267e82e6337c"
}
