<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/medium-bse1kypnf" -->

---
title: Medium | daily.dev
description: A guide to securing AI-powered APIs that use agentic workflows, covering authentication, authorization, least privilege for AI agents, rate limiting at...
canonical: https://daily.dev/posts/medium-bse1kypnf
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Medium | daily.dev
og:description: A guide to securing AI-powered APIs that use agentic workflows, covering authentication, authorization, least privilege for AI agents, rate limiting at...
og:url: https://daily.dev/posts/medium-bse1kypnf
og:image: https://api.daily.dev/og/posts/BSe1kYPNF.png
og:image:alt: Medium
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Medium

**[Medium](https://daily.dev/sources/medium_js)** · 11 min read · 0 upvotes · 0 comments

## Summary

A guide to securing AI-powered APIs that use agentic workflows, covering authentication, authorization, least privilege for AI agents, rate limiting at multiple levels, prompt injection defenses, tool argument validation, tool-level authorization, MCP security considerations, data minimization, server-side credential storage, human approval for high-risk actions, and audit logging. Laravel code examples illustrate middleware-based authentication, policy/gate authorization, and rate limiting. References OWASP's GenAI security guidance on excessive agency, prompt injection, and sensitive information disclosure. Concludes with a security checklist and the principle that the AI model should never be the final authority over security-sensitive actions.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://medium.com/@aasimghaffar442925/secure-ai-apis-in-2026-authentication-authorization-rate-limiting-and-protecting-agentic-8739c12fd84f>

## Questions this post answers

### How do I prevent an AI agent from performing unauthorized actions like issuing refunds it shouldn't?

Enforce authorization at the tool level, not just at the API layer, so every sensitive tool independently checks permissions before executing. For example, a refund tool should call something like $user->cannot('refund', $order) and throw an authorization exception if the check fails, even if the AI model requested that specific action. The AI model should never serve as the final authorization mechanism.

_Developers building agentic AI features can follow layered authorization patterns like this shared on daily.dev._

### What rate limiting strategy should I use for an AI agent that makes many API calls per user request?

Apply rate limits at multiple levels simultaneously: user, API key, agent, tenant, tool, workflow, and IP address, since a single user request can trigger many searches, database operations, external API calls, and model calls. Different tools should also get different limits, such as product search allowed 100 times per minute versus account deletion limited to once per day.

_Teams tuning rate limits for AI agents can compare approaches like this on daily.dev._

### How much customer data should I send to an AI model to minimize security exposure?

Send only the minimum fields the model needs to complete its task rather than an entire customer record. For instance, instead of passing name, email, phone, address, payment details, and internal notes, send just customer_id, account_status, and order_count. This data minimization principle reduces exposure if sensitive information disclosure occurs, a risk explicitly identified in OWASP's GenAI security guidance.

_Developers designing AI data pipelines can weigh minimization tactics like these via daily.dev._

## Similar posts on daily.dev

- [Ship AI with Laravel: I Tricked My Own AI Into Leaking Everything](https://daily.dev/posts/ship-ai-with-laravel-i-tricked-my-own-ai-into-leaking-everything-wpii6pnlw) · Laravel News · 0 upvotes · 0 comments
- [How to Stop an AI Agent from Destroying Your Laravel App](https://daily.dev/posts/how-to-stop-an-ai-agent-from-destroying-your-laravel-app-y8f9cyczn) · FREEK.DEV · 1 upvotes · 0 comments

---

Tags: [#security](https://daily.dev/tags/security), [#laravel](https://daily.dev/tags/laravel), [#authorization](https://daily.dev/tags/authorization), [#agentic-ai](https://daily.dev/tags/agentic-ai), [#prompt-injection](https://daily.dev/tags/prompt-injection)

[View this post on daily.dev](https://daily.dev/posts/medium-bse1kypnf)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Medium","url":"https://daily.dev/posts/medium-bse1kypnf","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/medium-bse1kypnf"},"datePublished":"2026-08-24T01:16:22.740Z","dateModified":"2026-08-24T01:24:37.123Z","description":"A guide to securing AI-powered APIs that use agentic workflows, covering authentication, authorization, least privilege for AI agents, rate limiting at...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/d6ab0a9a223ee01bc82d647f54feb2d2?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/d6ab0a9a223ee01bc82d647f54feb2d2?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Medium","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Medium","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/medium","url":"https://daily.dev/sources/medium_js"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/medium-bse1kypnf","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"security,laravel,authorization,agentic-ai,prompt-injection","timeRequired":"PT11M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Medium","item":"https://daily.dev/sources/medium_js"},{"@type":"ListItem","position":3,"name":"Medium"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/medium-bse1kypnf#faq","mainEntity":[{"@type":"Question","name":"How do I prevent an AI agent from performing unauthorized actions like issuing refunds it shouldn't?","acceptedAnswer":{"@type":"Answer","text":"Enforce authorization at the tool level, not just at the API layer, so every sensitive tool independently checks permissions before executing. For example, a refund tool should call something like $user->cannot('refund', $order) and throw an authorization exception if the check fails, even if the AI model requested that specific action. The AI model should never serve as the final authorization mechanism. Developers building agentic AI features can follow layered authorization patterns like this shared on daily.dev."}},{"@type":"Question","name":"What rate limiting strategy should I use for an AI agent that makes many API calls per user request?","acceptedAnswer":{"@type":"Answer","text":"Apply rate limits at multiple levels simultaneously: user, API key, agent, tenant, tool, workflow, and IP address, since a single user request can trigger many searches, database operations, external API calls, and model calls. Different tools should also get different limits, such as product search allowed 100 times per minute versus account deletion limited to once per day. Teams tuning rate limits for AI agents can compare approaches like this on daily.dev."}},{"@type":"Question","name":"How much customer data should I send to an AI model to minimize security exposure?","acceptedAnswer":{"@type":"Answer","text":"Send only the minimum fields the model needs to complete its task rather than an entire customer record. For instance, instead of passing name, email, phone, address, payment details, and internal notes, send just customer_id, account_status, and order_count. This data minimization principle reduces exposure if sensitive information disclosure occurs, a risk explicitly identified in OWASP's GenAI security guidance. Developers designing AI data pipelines can weigh minimization tactics like these via daily.dev."}}]}
```

