Morning! Anyone knows, by any chance if it is pos...
# help
r
Morning! Anyone knows, by any chance if it is possible, when using
APIGatewayV1API
, to make a specific endpoint public, and assign an API Key to it? Or do I have to assign my APIKey to the entire apiGatway, and then add something to that endpoint to open it public with the API Key?
t
I was just looking into this the other day, and I think you would need to set up a route like this to require an API key
Copy code
const api = new sst.ApiGatewayV1Api(this, 'api', {
  routes: {
    'GET /account': {
      function: 'src/account.handler',
      cdk: {
        method: {
          apiKeyRequired: true,
        }
      }
    }
  },
});
and then add the API key to the API
r
Sweet thanks, I'll add this and test it! 🙂