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

# Get/Create Token

> Get or create an MCP Identity Token for a user

# Get/Create Token

Get or create an MCP Identity Token (MIT) for a user. If the user doesn't exist, a new identity is created.

## Request

```bash theme={null}
curl -X POST https://api.mcprank.com/v1/identity/token \
  -H "X-API-Key: sk_mcp_rank_..." \
  -H "Content-Type: application/json" \
  -d '{"user_id": "user_123"}'
```

### Body Parameters

<ParamField body="user_id" type="string" required>
  Your user's unique identifier in your system
</ParamField>

## Response

<ResponseField name="access_token" type="string">
  The MCP Identity Token (JWT) - use this in Authorization header for proxy requests
</ResponseField>

<ResponseField name="refresh_token" type="string">
  Token for refreshing the MIT when it expires
</ResponseField>

<ResponseField name="expires_in" type="integer">
  Seconds until the access token expires (typically 3600 = 1 hour)
</ResponseField>

<ResponseField name="token_type" type="string">
  Always "Bearer"
</ResponseField>

### Example Response

```json theme={null}
{
  "access_token": "eyJhbGciOiJSUzI1NiIs...",
  "refresh_token": "rt_abc123...",
  "expires_in": 3600,
  "token_type": "Bearer"
}
```

## Usage

After obtaining the MIT, use it in proxy requests:

```bash theme={null}
curl https://api.mcprank.com/v1/proxy/google/gmail/v1/users/me/profile \
  -H "X-API-Key: sk_mcp_rank_..." \
  -H "Authorization: Bearer eyJhbGciOiJSUzI1NiIs..."
```

## Notes

* The MIT is a JWT containing `{user_id, developer_id, exp}`
* MITs expire after 1 hour - use the refresh token to get a new one
* OAuth tokens for providers are stored server-side, not in the MIT
* If the user hasn't connected a provider, proxy requests will return 403
