> ## Documentation Index
> Fetch the complete documentation index at: https://docs-staging-fix-docs-5528-php-updates.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

> Integrating Auth0's Management API endpoints with your PHP applications.

# Use the Management API

export const ReleaseStageNotice = ({feature, stage, plans, contact, terms}) => {
  const stageTextMap = {
    "beta": "Beta",
    "ea": "Early Access"
  };
  const stageText = stageTextMap[stage] || "a product release stage";
  const prsLink = "/docs/troubleshoot/product-lifecycle/product-release-stages";
  const linkify = (text, url) => {
    return <a href={url} target="_blank" rel="noreferrer" class="link">{text}</a>;
  };
  const includeDetails = (plans, contact, terms) => {
    const hasDetails = terms || plans || contact;
    if (!hasDetails) return null;
    return <span data-as="p">
            {plans && <>This feature is available for {linkify(`${plans} plans`, "https://auth0.com/pricing")}. </>}
            {contact && "To participate, contact " + contact + ". "}
            {terms && <>By using this feature, you agree to the applicable Free Trial terms in Okta's {linkify("Master Subscription Agreement", "https://www.okta.com/legal")}.</>}
        </span>;
  };
  return <Warning>
            <span data-as="p">
                <strong>The {feature} feature is in {linkify(stageText, prsLink)}.</strong>
            </span>

            {includeDetails(plans, contact, terms)}
        </Warning>;
};

<ReleaseStageNotice feature="Auth0 PHP SDK v9" stage="beta" />

The Auth0 PHP SDK provides a `Auth0\SDK\API\Management` class, which houses the methods you can use to access the [Management API](https://auth0.com/docs/api/management/v2) and perform operations on your Auth0 tenant. Using this interface, you can easily:

* Search for and create users
* Create and update Applications
* Retrieve log entries
* Manage rules

... and much more. See our [API reference](https://auth0.com/docs/api/management/v2) for information on what's possible!
Authentication

To use the <Tooltip tip="Management API: A product to allow customers to perform administrative tasks." cta="View Glossary" href="/docs/glossary?term=Management+API">Management API</Tooltip>, you must authenticate one of two ways:

* For temporary access or testing, you can [manually generate an API token](/docs/secure/tokens/access-tokens/management-api-access-tokens) and save it in your `.env` file.
* For extended access, you must create and execute and Client Credentials grant when access is required. This process is detailed on the [Authentication API page](/docs/libraries/auth0-php/using-the-authentication-api-with-auth0-php).

Regardless of the method, the token generated must have the scopes required for the operations your app wants to execute. Consult the [API documentation](https://auth0.com/docs/api/management/v2) for the scopes required for the specific endpoint you're trying to access.

To grant the scopes needed:

1. Go to [APIs](https://manage.auth0.com/#/apis) > Auth0 Management API > **Machine to Machine Applications** tab.
2. Find your Application and authorize it.
3. Click the arrow to expand the row and select the scopes required.

Now you can authenticate one of the two ways above and use that token to perform operations:

```php lines theme={null}
$management = new \Auth0\SDK\API\Management\Wrapper\ManagementClient(
    new \Auth0\SDK\API\Management\Wrapper\ManagementClientOptions(
        domain: $env['AUTH0_DOMAIN'],
        clientId: $env['AUTH0_CLIENT_ID'],
        clientSecret: $env['AUTH0_CLIENT_SECRET'],
    ),
);
```

The `ManagementClient` exposes endpoints as properties (for example, `$management->users` and `$management->clients`). Results are returned as typed objects — you retrieve values by calling named methods (such as `getEmail()` or `getName()`) rather than unpacking a raw array.

### Example - Search Users by Email

This endpoint is documented [here](https://auth0.com/docs/api/management/v2#!/Users/get_users).

```php lines theme={null}
$users = $management->users->list(
    new \Auth0\SDK\API\Management\Users\Requests\ListUsersRequestParameters([
        'q'             => 'email:j*',
        'perPage'       => 5,
        'includeTotals' => true,
    ]),
);

foreach ($users as $user) {
    printf("%s <%s> - %s\n", $user->getNickname() ?? 'No nickname', $user->getEmail() ?? 'No email', $user->getUserId());
}
```

### Example - Get All Clients

This endpoint is documented [here](https://auth0.com/docs/api/management/v2#!/Clients/get_clients).

```php lines theme={null}
$clients = $management->clients->list(
    new \Auth0\SDK\API\Management\Clients\Requests\ListClientsRequestParameters([
        'perPage'       => 5,
        'includeTotals' => true,
    ]),
);

foreach ($clients as $client) {
    printf("%s - %s\n", $client->getName(), $client->getClientId());
}
```

## Learn more

* [PHP: Getting Started using Auth0-PHP](/docs/libraries/auth0-php)
* [PHP: Logging in, out, and returning user profiles with Auth0-PHP](/docs/libraries/auth0-php/auth0-php-basic-use)
* [PHP: Using the Authentication API with Auth0-PHP](/docs/libraries/auth0-php/using-the-authentication-api-with-auth0-php)
* [PHP: Validating JWTs (JSON Web Tokens) with Auth0-PHP](/docs/libraries/auth0-php/validating-jwts-with-auth0-php)
* [PHP: Troubleshooting your Auth0-PHP integration](/docs/libraries/auth0-php/troubleshoot-auth0-php-library)
