> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://contentful.com/developers/docs/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://contentful.com/_mcp/server. # Get an access token GET https://api.contentful.com/users/me/access_tokens/{token_id} This endpoint returns details about an existing CMA token. Reference: https://contentful.com/developers/docs/references/content-management-api/access-tokens/get-an-access-token ## Authentication - `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer `, where token is your auth token. ## Request ### Path parameters - `token_id` (string, required) — ID of the personal access token in a form of a string ## Response ### 200 OK - Request successful - `map from string to any` ## Examples **Response** ```json { "name": "My Token", "revokedAt": null, "scopes": [ "content_management_manage" ], "sys": { "application": { "sys": { "id": "", "linkType": "Application", "type": "Link" } }, "createdAt": "2025-05-03T06:45:31.000Z", "expiresAt": null, "id": "exampletokenid", "lastUsedAt": null, "redactedValue": "TmTU", "type": "PersonalAccessToken", "updatedAt": "2025-05-03T06:45:31.000Z" } } ``` **SDK Code** ```android Android // Create the Contentful client. final CMAClient client = new CMAClient .Builder() .setAccessToken("") .setSpaceId("") .setEnvironmentId("") .build(); client .personalAccessTokens() .async() .fetchOne( "", new CMACallback() { @Override protected void onSuccess(CMAPersonalAccessToken result) { new AlertDialog.Builder(context) .setTitle("Contentful") .setMessage("Successfully fetched your favorite access token." + "\n\nResult: " + result) .show(); } @Override protected void onFailure(RuntimeException exception) { // An error occurred! Inform the user. new AlertDialog.Builder(context) .setTitle("Contentful Error") .setMessage("Could not fetch the token." + "\n\nReason: " + exception.toString()) .show(); super.onFailure(exception); } } ); ``` ```java Java // Create the Contentful client. final CMAClient client = new CMAClient .Builder() .setAccessToken("") .setSpaceId("") .setEnvironmentId("") .build(); final CMAPersonalAccessToken token = client .personalAccessTokens() .fetchOne(""); ``` ```kotlin Kotlin // Create the Contentful client. val client = CMAClient.Builder() .setAccessToken("") .setSpaceId("") .setEnvironmentId("") .build() val token = client .personalAccessTokens() .fetchOne("") ``` ```swift Swift We currently don't provide a CMA SDK for this platform. ``` ```js-legacy JavaScript (legacy) import { createClient } from 'contentful-management' const client = createClient({ accessToken: '' }, { type: 'legacy' }) client.getAccessToken('') .then((accessToken) => console.log(accessToken.token)) .catch(console.error) ``` ```javascript JavaScript import { createClient } from 'contentful-management' // Client init const client = createClient({ accessToken: '' }) await client.accessToken.get({ tokenId: '', }); ``` ```php PHP $client = new \Contentful\Management\Client(''); $token = $client->getPersonalAccessToken(''); ``` ```ruby Ruby require 'contentful/management' client = Contentful::Management::Client.new('') personal_access_token = client.personal_access_tokens.find('') ``` ```python Python from contentful_management import Client client = Client('') personal_access_token = client.personal_access_tokens().find('') ``` ```.net .NET // This client should only be created once per application. var httpClient = new HttpClient(); var client = new ContentfulManagementClient(httpClient, "", ""); // Note that the actual access token will not be a part of the response. // It is only available during creation for security reasons. var token = await client.GetManagementToken(""); ```