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

# Direct API access

> How to access the API client directly using Algolia SearchBundle.

In some cases, you might want to access the Algolia client directly to perform advanced operations,
like managing API keys and managing indices.

The bundle exposes two ways to obtain the `Algolia\AlgoliaSearch\Api\SearchClient`:

* **Preferred**: [inject it](/doc/framework-integration/symfony/getting-started/quick-start) by type-hinting the constructor. Symfony autowires the client for you.
* **From the container**: retrieve it with the public `search.client` service ID. For example, `$container->get('search.client')`.

For example:

```php PHP icon=code theme={"system"}
use Algolia\AlgoliaSearch\Api\SearchClient;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\JsonResponse;

class TestController extends AbstractController
{
    public function listApiKeysAction(SearchClient $client): JsonResponse
    {
        return new JsonResponse($client->listApiKeys());
    }
}
```
