APIGatewayProxyEventV2: {
    body?: string;
    cookies?: string[];
    headers: Record<string, string>;
    isBase64Encoded: boolean;
    pathParameters?: null | Record<string, string>;
    queryStringParameters?: Record<string, string>;
    rawPath: string;
    rawQueryString: string;
    requestContext: {
        accountId: string;
        apiId: string;
        authentication?:
            | null
            | {
                clientCert?: {
                    clientCertPem: string;
                    issuerDN: string;
                    serialNumber: string;
                    subjectDN: string;
                    validity: { notAfter: string; notBefore: string };
                };
            };
        authorizer?: {
            iam?: {
                accessKey?: string;
                accountId?: string;
                callerId?: string;
                cognitoIdentity?: | null
                | { amr: string[]; identityId: string; identityPoolId: string };
                principalOrgId?: null | string;
                userArn?: string;
                userId?: string;
            };
            jwt?: { claims: Record<string, any>; scopes: null | string[] };
            lambda?: null | Record<string, any>;
        };
        domainName: string;
        domainPrefix: string;
        http: {
            method: | "GET"
            | "POST"
            | "PUT"
            | "PATCH"
            | "DELETE"
            | "HEAD"
            | "OPTIONS";
            path: string;
            protocol: string;
            sourceIp: string;
            userAgent: string;
        };
        requestId: string;
        routeKey: string;
        stage: string;
        time: string;
        timeEpoch: number;
    };
    routeKey: string;
    stageVariables?: null
    | Record<string, string>;
    version: string;
}

A zod schema for an API Gateway HTTP API Proxy event

Type declaration

  • Optionalbody?: string
  • Optionalcookies?: string[]
  • headers: Record<string, string>
  • isBase64Encoded: boolean
  • OptionalpathParameters?: null | Record<string, string>
  • OptionalqueryStringParameters?: Record<string, string>
  • rawPath: string
  • rawQueryString: string
  • requestContext: {
        accountId: string;
        apiId: string;
        authentication?:
            | null
            | {
                clientCert?: {
                    clientCertPem: string;
                    issuerDN: string;
                    serialNumber: string;
                    subjectDN: string;
                    validity: { notAfter: string; notBefore: string };
                };
            };
        authorizer?: {
            iam?: {
                accessKey?: string;
                accountId?: string;
                callerId?: string;
                cognitoIdentity?: | null
                | { amr: string[]; identityId: string; identityPoolId: string };
                principalOrgId?: null | string;
                userArn?: string;
                userId?: string;
            };
            jwt?: { claims: Record<string, any>; scopes: null | string[] };
            lambda?: null | Record<string, any>;
        };
        domainName: string;
        domainPrefix: string;
        http: {
            method: | "GET"
            | "POST"
            | "PUT"
            | "PATCH"
            | "DELETE"
            | "HEAD"
            | "OPTIONS";
            path: string;
            protocol: string;
            sourceIp: string;
            userAgent: string;
        };
        requestId: string;
        routeKey: string;
        stage: string;
        time: string;
        timeEpoch: number;
    }
  • routeKey: string
  • OptionalstageVariables?: null | Record<string, string>
  • version: string
{
"version": "2.0",
"routeKey": "$default",
"rawPath": "/my/path",
"rawQueryString": "parameter1=value1&parameter1=value2&parameter2=value",
"cookies": ["cookie1", "cookie2"],
"headers": {
"header1": "value1",
"header2": "value1,value2"
},
"queryStringParameters": {
"parameter1": "value1,value2",
"parameter2": "value"
},
"requestContext": {
"accountId": "123456789012",
"apiId": "api-id",
"authentication": {}
"domainName": "id.execute-api.us-east-1.amazonaws.com",
"domainPrefix": "id",
"http": {
"method": "POST",
"path": "/my/path",
"protocol": "HTTP/1.1",
"sourceIp": "...",
"userAgent": "..."
},
"requestId": "...",
"routeKey": "$default",
"stage": "$default",
"time": "12/Mar/2020:19:03:58 +0000",
"timeEpoch": 1583348638390
},
"body": "Hello from Lambda",
"pathParameters": {},
"isBase64Encoded": false,
"stageVariables": {}
}