APIPortal / Client / list_api_inventory_items

list_api_inventory_items

APIPortal.Client.list_api_inventory_items(**kwargs)

Lists discovered API inventory items with filtering and pagination.

See also: AWS API Documentation

Request Syntax

response = client.list_api_inventory_items(
    filters={
        'discoverySource': 'API_GATEWAY'|'ELB'|'CLOUDFRONT',
        'resourceArn': 'string'
    },
    maxResults=123,
    nextToken='string'
)
Parameters:
  • filters (dict) –

    Filters that limit the results. Omit it to list every discovered API.

    • discoverySource (string) –

      The AWS service that is the SOURCE of discovered APIs — i.e. the front-door service type whose resources discovery crawls to find APIs. New source services may be added over time, so clients MUST treat any unrecognized value gracefully.

    • resourceArn (string) –

      Return only APIs served by this resource.

  • maxResults (integer) – The maximum number of results to return in one page, from 1 to 100.

  • nextToken (string) – The pagination token returned by a previous call. Omit it to get the first page.

Return type:

dict

Returns:

Response Syntax

{
    'items': [
        {
            'method': 'GET'|'POST'|'PUT'|'DELETE'|'PATCH'|'ANY'|'HEAD'|'OPTIONS',
            'host': 'string',
            'port': 123,
            'path': 'string',
            'accountId': 'string',
            'resourceArn': 'string',
            'region': 'string',
            'discoverySource': 'API_GATEWAY'|'ELB'|'CLOUDFRONT',
            'firstSeen': datetime(2015, 1, 1),
            'lastSeen': datetime(2015, 1, 1),
            'visibility': 'PUBLIC'|'PRIVATE',
            'wafStatus': 'ENABLED'|'DISABLED',
            'classification': 'SHADOW'|'MANAGED'|'MANAGED_ZOMBIE'|'MANAGED_ORPHANED',
            'managedBy': 'SELF'|'ORGANIZATION',
            'workloads': [
                'MCP'|'LLM'|'A2A',
            ]
        },
    ],
    'nextToken': 'string'
}

Response Structure

  • (dict) –

    • items (list) –

      The discovered APIs in this page of results.

      • (dict) –

        An API found by discovery.

        • method (string) –

          The HTTP method of the API.

        • host (string) –

          A discovered API’s front-door hostname (e.g. an ALB, CloudFront, or API Gateway DNS name), bounded by the DNS name limit (RFC 1035). Usually literal, but may contain placeholders: <> - stands for one dot-separated part of the hostname. When 10 or more hosts differ only in that part, they fold into one, e.g. a.example.com, b.example.com, … become “<>.example.com”. Deeper levels fold the same way (“<>.<>.example.com”). The registrable domain never folds. - an IP-literal host.

        • port (integer) –

          The port the API listens on, from 0 to 65535.

        • path (string) –

          The request path of the API.

        • accountId (string) –

          The AWS account ID that owns the API.

        • resourceArn (string) –

          The ARN of the resource that serves the API, such as an API Gateway stage or a load balancer.

        • region (string) –

          The AWS Region the API was discovered in.

        • discoverySource (string) –

          The AWS service that is the SOURCE of discovered APIs — i.e. the front-door service type whose resources discovery crawls to find APIs. New source services may be added over time, so clients MUST treat any unrecognized value gracefully.

        • firstSeen (datetime) –

          When discovery first observed the API.

        • lastSeen (datetime) –

          When discovery most recently observed the API.

        • visibility (string) –

          Whether a discovered API is reachable publicly or only from within a private network.

        • wafStatus (string) –

          Whether a WAF web ACL is attached to the API’s front-door service.

        • classification (string) –

          Whether any account has created a ManagedApi for a discovered API, and for a managed API whether it is unused or no longer in the caller’s organization. SHADOW - no account has created a ManagedApi for this item. MANAGED - some account in the caller’s organization has created a ManagedApi for this item. MANAGED_ZOMBIE - managed and unused: no traffic for at least the account’s no-traffic window. The API is still reachable, so this clears once traffic resumes. MANAGED_ORPHANED - managed, but the account hosting the API has left the caller’s organization or been closed. The item is a last-known snapshot: it is no longer rediscovered, and its findings are not authorized for the caller. An organizational unit move is not a trigger.

          MANAGED_ZOMBIE and MANAGED_ORPHANED add detail to a MANAGED item, so neither is returned for an item the caller does not manage, and MANAGED_ORPHANED takes priority over MANAGED_ZOMBIE. Both are derived per request rather than stored, so neither expires on its own.

        • managedBy (string) –

          Who manages a MANAGED item, relative to the caller. Absent when the item is SHADOW. SELF - the caller account has created the ManagedApi. ORGANIZATION - some other account in the caller’s organization has, but the caller has not.

        • workloads (list) –

          AI protocols seen in this API’s traffic, each listed at most once. Absent when none has been reported, which includes an account that has not enabled AI discovery.

          • (string) –

            An AI protocol seen in an API’s traffic, detected by the front door from request or response headers (and, for A2A, a query parameter). MCP - Model Context Protocol. LLM - traffic to or from an LLM inference server or gateway. A2A - Agent2Agent protocol.

    • nextToken (string) –

      The token to pass in the next request to get the next page. Absent when there are no more results.

Exceptions

  • APIPortal.Client.exceptions.BadRequestException

  • APIPortal.Client.exceptions.AccessDeniedException

  • APIPortal.Client.exceptions.InternalServerException