Tokens API — Queries

Retrieve all API tokens created by the authenticated user.

Endpoint
POSThttps://api.udacity.com/api/public/api/v1/tokens/graphql

tokens

Retrieve all API tokens created by the authenticated user.

Authentication: Requires logged-in user (JWT).

Return type: [Token!]!

Signature
type Query {
  tokens: [Token!]!
}
Query
query MyTokens {
  tokens {
    id
    redactedToken
    description
    createdBy
    createdAt
    updatedAt
    expiresAt
    revokedAt
    scopes {
      id
      scopeType
      scopeKey
      createdAt
    }
  }
}
Response
{
  "data": {
    "tokens": [
      {
        "id": "token-001",
        "redactedToken": "abc1****5678",
        "description": "Production reporting token",
        "createdBy": "user-123",
        "createdAt": "2025-01-10T08:00:00Z",
        "updatedAt": "2025-01-10T08:00:00Z",
        "expiresAt": "2025-04-10T08:00:00Z",
        "revokedAt": null,
        "scopes": [
          {
            "id": "scope-001",
            "scopeType": "COMPANY",
            "scopeKey": "4821",
            "createdAt": "2025-01-10T08:05:00Z"
          }
        ]
      }
    ]
  }
}