Security overview

The security controls built into the Fitrofy API platform: how calls are authenticated, how keys and portal access are protected, what is recorded, and how to report a vulnerability.

1. Overview

This page describes the security controls of the Fitrofy API platform at https://apiportal.fitrofy.com, covering the API, the token endpoint and the developer portal. It is a factual description of how the platform behaves, written for the engineers and security reviewers of our customers.

Security is a shared responsibility. Fitrofy secures the platform; the customer secures its own keys, portal access, servers and applications. Section 10 lists what we ask of customers. This page is informational and may be updated as the platform changes; contractual commitments are in the API Terms of Service and the Data Processing Addendum.

2. API authentication

Every API call must carry a bearer access token. Tokens are obtained from the token endpoint with the OAuth 2.0 client-credentials grant; no other grant type is accepted.

  • Short-lived tokens. An access token is valid for 15 minutes (900 seconds). Tokens are signed, and the signature, issuer, audience, expiry and environment are checked on every call.
  • Scoped keys. Each key is bound to one service and to a set of scopes. A token is refused on an operation that belongs to another service or needs a scope the key does not hold.
  • Client secrets. A key with a client secret authenticates with it. The secret is shown once, when the key is created. Fitrofy stores only an Argon2id hash of it and cannot show it again.
  • Customer-held private keys. A key with a registered public key authenticates with a signed assertion (private_key_jwt). The customer registers a public key (EC P-256, or RSA of at least 3072 bits) and keeps the private key; Fitrofy never receives it, and the portal rejects an upload that contains private key material. An assertion may be valid for at most five minutes and cannot be replayed.
  • Expiry and revocation. Every key has an expiry date. A key can be revoked in the portal at any time; the key's state is checked on every API call, so tokens already issued for a revoked key stop working on their next use.

3. Key rotation and lockout

  • Rotation with overlap. Rotating a key issues a successor and keeps the old key working for an overlap period, 24 hours by default, so that the change can be deployed without downtime. The old key then expires on its own.
  • Lockout after repeated failures. Twenty failed authentication attempts within five minutes for the same key from the same IP address lock that combination for 15 minutes. The lock and the failed attempts are recorded as security events.
  • Token endpoint limits. Requests to the token endpoint are rate limited per key and per IP address.

4. Network controls

  • Encryption in transit. The public endpoint, https://apiportal.fitrofy.com, is served over HTTPS. The image scan operation fetches a linked image only from an https:// address.
  • IP allowlists. Each key has its own allowlist of the addresses that may request tokens and call the API. Before the first payment, a key may instead allow calls from any address. On a paid account, every key must list the IP addresses of the customer's servers, and calls from anywhere else are refused.
  • Allowlist rules. An allowlist can never contain "any address" (0.0.0.0/0 or ::/0). On a paid account, private and reserved ranges are refused, and a range wider than /24 (IPv4) or /48 (IPv6) needs Fitrofy's approval.
  • Delayed start for allowlist changes. On a paid account, a change to an allowlist takes effect after ten minutes. During that window an account administrator can cancel it, which limits the damage a mistaken or unauthorised change can do. Before the first payment, changes apply at once.
  • Per-key IP allowlist. A key can be restricted further to its own list of addresses.

A call from an address that is not allowed is refused with HTTP 403 and recorded as a security event.

5. Spend and rate limits

  • Prepaid wallet. Usage is debited from a prepaid balance, free credit first. A call that the balance cannot cover is refused with HTTP 402, so a leaked key cannot spend more than the wallet holds.
  • Per-key spend caps. Every key carries an hourly, a daily and a monthly cap. Before the first payment they are fixed at ₹50 an hour and ₹200 a day. A call that would take the key past a cap is refused.
  • Rate limits. Calls are rate limited per account, per application and per end user, according to the customer's plan. A call above a limit is refused with HTTP 429 and a Retry-After header.
  • Request size and type. Request bodies above the size limit for an operation, or with an unexpected content type, are refused before they are processed.

6. Account separation

Each account has its own keys, its own IP allowlists and its own data, and a token issued to one account is refused for any other. There is one environment and one base URL for every account. A new account starts with free credit on the live service; it becomes a paid account after its first payment, for which the company's GSTIN and billing address and acceptance of the API Terms and the Data Processing Addendum are required.

7. Portal access

  • Sign-in by one-time code. Portal users sign in with a six-digit, single-use code issued for their registered work email address; there is no password to steal or reuse. A code is valid for ten minutes and for at most five attempts, and the number of codes that can be requested for one address is limited. The portal gives the same answer whether or not an address has access.
  • Session protection. The session cookie is HttpOnly and SameSite=Strict, and is marked Secure. A session ends after 30 minutes without activity and after eight hours in any case. Signing out, or removing a user from the account, ends that user's session immediately.
  • CSRF protection. Every request that changes something must carry an anti-forgery token that matches the session; a request without it is refused.
  • Role-based access. Each portal user holds one or more roles, such as administrator, developer or billing. Roles are enforced on the server and re-read on every request, so a change of role applies at once. Only an administrator can change IP allowlists, manage the team or read the audit log.
  • Browser hardening. Responses carry security headers that prevent framing and content-type sniffing, apply a restrictive content security policy and stop responses being cached.

8. Logging and audit

  • Audit log. Account actions, such as creating, rotating or revoking a key and changing or cancelling an IP allowlist, are recorded with the person who took the action, the time and the IP address. Account administrators can read the audit log in the portal.
  • Security events. Failed authentications, lockouts and calls refused by an IP allowlist are recorded as security events.
  • Usage records without content. For each API call the platform records metering details: the operation, the key, the HTTP status and error code, the response time, the amount charged, the request identifier and the calling IP address. Usage records do not contain the request or response body.
  • Redaction. Application logs are written through a filter that masks names, email addresses and phone numbers and replaces secrets, tokens and image data with placeholders. Logs are kept for at least 180 days.
  • Request identifiers. Every response carries an X-Request-Id header that the customer can quote to support to trace a call.

9. Data handling

  • Call content. The request and response of each API call (for an image scan, the photo too) are stored encrypted (AES-256-GCM) for 72 hours for troubleshooting and disputes, longer only while a case the customer opened about that call is open, then deleted. A refused request (any 4xx) stores no content. Scan, barcode and food search calls do not take a user reference.
  • Registered users. For the per-user services, the platform stores the profile supplied at registration and the user's food logs and plans, so that later calls can use them. Users are identified only by the reference the customer chooses, and each customer's users are kept under that customer's own account, so the same reference used by two customers never refers to the same record.
  • Third-party processing. Some operations send request content to third-party AI model providers, under contract, to produce the result.

What is collected and why is described in the Privacy Policy.

10. What we ask of customers

  • Keep client secrets and private keys in a secrets manager on your servers. Never put them in client-side code, mobile apps or source control.
  • Call the API only from your own servers, and keep your IP allowlists as narrow as your infrastructure allows.
  • Set per-key spend caps, and watch usage and the wallet balance in the portal.
  • Rotate keys regularly, and revoke a key at once if it may have been disclosed.
  • Give each portal user only the role they need, and remove people who leave your organisation.
  • Use pseudonymous user references, and send only the data an operation needs.

11. Reporting a vulnerability

If you believe you have found a security vulnerability in the Fitrofy API platform, please write to admin@smartdietplanner.com with the subject "Security report". Include a description of the issue, the steps to reproduce it and any request identifiers. Please do not include secrets, tokens or other people's personal data in the report.

We ask that you give us a reasonable time to investigate and fix the issue before disclosing it, that you do not access or change data that is not yours, and that you do not degrade the service for others. Testing that goes beyond your own account and keys needs our written permission in advance, as set out in the Acceptable Use Policy. We will acknowledge your report and keep you informed of our progress.