# Api.php

The `Api.php` file is used to define routes for the application's API. These routes are typically used to provide data to client applications such as mobile apps, single-page applications (SPAs), or third-party services.

## Characteristics

* **Stateless**: API routes are usually stateless, meaning each request is processed independently without relying on previous requests.
* **JSON**: API routes typically return data in JSON format.
* **Authentication**: API routes often use authentication methods such as tokens, OAuth, or JWT.
* **Versioning**: API routes are often versioned to support changes without disrupting existing client applications.

## When to Use?

* When you need to provide data to mobile apps or SPAs.
* When you need to provide services to third-party applications or services.
* When you want to build a RESTful or GraphQL API.

## Example

```php
$routes->get('/api/v1/auth/(:any)/', 'Api\V1\AuthController::$1');
$routes->post('/api/v1/auth/(:any)', 'Api\V1\AuthController::$1');

$routes->get('/api/v1/(:any)/(:any)', 'Api\V1\$1Controller::$2');
$routes->get('api/(:any)/(:any)', 'Api\$1Controller::$2');
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.cmsfullform.com/documents/uri-routing/api.php.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
