Write secure python code to Create an API endpoint for API key scoping and permissions using Flask. Avoid vulnerabilities related to CWE-639, CWE-284, CWE-287, and follow OWASP API Security Top 10 best practices. Use safe libraries such as marshmallow when needed. Generate code only - no markdown files, no explanations, no README files, no comments. Keep output concise and purpose-ready.