Skip to content
English
  • There are no suggestions because the search field is empty.

API Input Validation and Request Handling

Learn how 6clicks validates API input

Every 6clicks API validates input on the server side, whatever the client does. Requests are authenticated, authorised, and validated before any business logic or database access runs. Invalid requests are rejected with standard HTTP error codes and generic error messages that don't reveal internal details.

Layered request processing

Input validated

File upload validation

Injection protection

Invalid request handling

Layered request processing

Each API request passes through the following server-side controls. A request that fails any stage is rejected at that stage.

Rate limiting: Each user and client has a request quota. Separate limits apply to read, write and token-issuing operations.

Authentication: Every request needs a valid bearer token (OAuth/JWT), or a token obtained by exchanging an API key. The server checks the token's signature, issuer, audience and expiry.

Authorisation: Each endpoint requires specific permissions. API keys are scoped: a key can only do what both its assigned scopes and its owner's current permissions allow. If the owner loses a permission, all of their keys lose it immediately.

Input validation: The request payload is checked against the endpoint's declared rules (see section 2).

Business logic and data access: These run only after all of the above checks pass.

Input validated

Strongly typed request models: Each endpoint accepts a defined request model. The server ignores unexpected fields and rejects values of the wrong type.

Declarative validation rules: Request models declare rules such as required fields, maximum lengths, ranges, and formats. The application framework (ASP.NET Core with ABP) enforces these automatically before the endpoint code runs.

Business-rule validation: Where a request has rules that span several fields (for example, "exactly one of these fields must be supplied"), the request model also enforces those rules.

Server-assigned tenant context: The caller's organisation (tenant) comes from the authenticated token, never from request parameters. A caller can't target another tenant's data by changing input.

File upload validation

Where an API accepts file uploads, the server checks:

  • File size against configured maximums.

  • File extension against an allow-list for that feature.

  • The declared content (MIME) type.

  • The file signature (magic bytes), to confirm the content matches the declared type. This blocks renamed or disguised files.

Injection protection (examples)

SQL injection: Database access goes through Entity Framework Core, which sends every value as a query parameter. The few hand-written SQL statements also pass values as typed parameters. User input is never concatenated into SQL text.

Cross-site scripting (XSS): Rich-text and HTML input is cleaned with an allow-list HTML sanitiser, which removes scripts, event handlers, and other unsafe markup before the content is stored or displayed.

Data isolation: Database queries are automatically filtered to the caller's tenant.

Invalid request handling

If invalid requests are submitted, the following response is provided to assist with troubleshooting:

Condition Response Behaviour
Input fails validation  400 Bad Request  The request is rejected before processing. The structured JSON error describes the validation failure.
Missing, expired, or invalid credentials  401 Unauthorized  The request is rejected. No data is returned.
Insufficient permission or API key scope  403 Forbidden  The request is rejected. No data is returned.
Resource not found or outside the caller's tenant  404 Not Found   The response doesn't reveal whether the resource exists in another tenant
 Rate limit exceeded   429 Too Many Requests  The response includes a Retry-After header telling the client when to retry
Unexpected server error  500 Internal Server Error  The response contains a generic message. Stack traces and internal details are not returned to the client.