Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Implement OAuth 2.0 authentication flows for Telnyx API access. This skill provides Ruby SDK examples.
.claude/skills/team-telnyx-telnyx-oauth-ruby/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-03 | ✗→✓ | ▲ Improved | 184% | 0% |
| case-12 | ✗→✓ | ▲ Improved | 91% | 0% |
| case-01 | ✗→✓ | ▲ Improved | 156% | 0% |
| case-02 | ✗→✓ | ▲ Improved | 130% | 0% |
| case-04 | ✗→✓ | ▲ Improved | 72% | 0% |
<!-- Auto-generated from Telnyx OpenAPI specs. Do not edit. -->
bashgem install telnyx
rubyrequire "telnyx" client = Telnyx::Client.new( api_key: ENV["TELNYX_API_KEY"], # This is the default and can be omitted )
All examples below assume client is already initialized as shown above.
All API calls can fail with network errors, rate limits (429), validation errors (422), or authentication errors (401). Always handle errors in production code:
rubybegin result = client.messages.send_(to: "+13125550001", from: "+13125550002", text: "Hello") rescue Telnyx::Errors::APIConnectionError puts "Network error — check connectivity and retry" rescue Telnyx::Errors::RateLimitError # 429: rate limited — wait and retry with exponential backoff sleep(1) # Check Retry-After header for actual delay rescue Telnyx::Errors::APIStatusError => e puts "API error #{e.status}: #{e.message}" if e.status == 422 puts "Validation error — check required fields and formats" end end
Common error codes: 401 invalid API key, 403 insufficient permissions, 404 resource not found, 422 validation error (check field formats), 429 rate limited (retry with exponential backoff).
.auto_paging_each for automatic iteration: page.auto_paging_each { |item| puts item.id }.OAuth 2.0 Authorization Server Metadata (RFC 8414)
GET /.well-known/oauth-authorization-server
rubyresponse = client.well_known.retrieve_authorization_server_metadata puts(response)
Returns: authorization_endpoint (uri), code_challenge_methods_supported (arraystring]), grant_types_supported (arraystring]), introspection_endpoint (uri), issuer (uri), jwks_uri (uri), registration_endpoint (uri), response_types_supported (arraystring]), scopes_supported (arraystring]), token_endpoint (uri), token_endpoint_auth_methods_supported (arraystring])
OAuth 2.0 Protected Resource Metadata for resource discovery
GET /.well-known/oauth-protected-resource
rubyresponse = client.well_known.retrieve_protected_resource_metadata puts(response)
Returns: authorization_servers (arraystring]), resource (uri)
OAuth 2.0 authorization endpoint for the authorization code flow
GET /oauth/authorize
rubyresult = client.oauth.retrieve_authorize( client_id: "550e8400-e29b-41d4-a716-446655440000", redirect_uri: "https://example.com", response_type: :code ) puts(result)
Retrieve details about an OAuth consent token
GET /oauth/consent/{consent_token}
rubyoauth = client.oauth.retrieve("consent_token") puts(oauth)
Returns: client_id (string), logo_uri (uri), name (string), policy_uri (uri), redirect_uri (uri), requested_scopes (arrayobject]), tos_uri (uri), verified (boolean)
Create an OAuth authorization grant
POST /oauth/grants — Required: allowed, consent_token
rubyresponse = client.oauth.grants(allowed: true, consent_token: "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.example") puts(response)
Returns: redirect_uri (uri)
Introspect an OAuth access token to check its validity and metadata
POST /oauth/introspect — Required: token
rubyresponse = client.oauth.introspect(token: "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.example") puts(response)
Returns: active (boolean), aud (string), client_id (string), exp (integer), iat (integer), iss (string), scope (string)
Retrieve the JSON Web Key Set for token verification
GET /oauth/jwks
rubyresponse = client.oauth.retrieve_jwks puts(response)
Returns: keys (arrayobject])
Register a new OAuth client dynamically (RFC 7591)
POST /oauth/register
Optional: client_name (string), grant_types (arraystring]), logo_uri (uri), policy_uri (uri), redirect_uris (arraystring]), response_types (arraystring]), scope (string), token_endpoint_auth_method (enum: none, client_secret_basic, client_secret_post), tos_uri (uri)
rubyresponse = client.oauth.register puts(response)
Returns: client_id (string), client_id_issued_at (integer), client_name (string), client_secret (string), grant_types (arraystring]), logo_uri (uri), policy_uri (uri), redirect_uris (arraystring]), response_types (arraystring]), scope (string), token_endpoint_auth_method (string), tos_uri (uri)
Exchange authorization code, client credentials, or refresh token for access token
POST /oauth/token — Required: grant_type
Optional: client_id (string), client_secret (string), code (string), code_verifier (string), redirect_uri (uri), refresh_token (string), scope (string)
rubyresponse = client.oauth.token(grant_type: :client_credentials) puts(response)
Returns: access_token (string), expires_in (integer), refresh_token (string), scope (string), token_type (enum: Bearer)
Retrieve a paginated list of OAuth clients for the authenticated user
GET /oauth_clients
rubypage = client.oauth_clients.list puts(page)
Returns: allowed_grant_types (arraystring]), allowed_scopes (arraystring]), client_id (string), client_secret (string | null), client_type (enum: public, confidential), created_at (date-time), logo_uri (uri), name (string), org_id (string), policy_uri (uri), record_type (enum: oauth_client), redirect_uris (arraystring]), require_pkce (boolean), tos_uri (uri), updated_at (date-time), user_id (string)
Create a new OAuth client
POST /oauth_clients — Required: name, allowed_scopes, client_type, allowed_grant_types
Optional: logo_uri (uri), policy_uri (uri), redirect_uris (arraystring]), require_pkce (boolean), tos_uri (uri)
rubyoauth_client = client.oauth_clients.create( allowed_grant_types: [:client_credentials], allowed_scopes: ["admin"], client_type: :public, name: "My OAuth client" ) puts(oauth_client)
Returns: allowed_grant_types (arraystring]), allowed_scopes (arraystring]), client_id (string), client_secret (string | null), client_type (enum: public, confidential), created_at (date-time), logo_uri (uri), name (string), org_id (string), policy_uri (uri), record_type (enum: oauth_client), redirect_uris (arraystring]), require_pkce (boolean), tos_uri (uri), updated_at (date-time), user_id (string)
Retrieve a single OAuth client by ID
GET /oauth_clients/{id}
rubyoauth_client = client.oauth_clients.retrieve("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") puts(oauth_client)
Returns: allowed_grant_types (arraystring]), allowed_scopes (arraystring]), client_id (string), client_secret (string | null), client_type (enum: public, confidential), created_at (date-time), logo_uri (uri), name (string), org_id (string), policy_uri (uri), record_type (enum: oauth_client), redirect_uris (arraystring]), require_pkce (boolean), tos_uri (uri), updated_at (date-time), user_id (string)
Update an existing OAuth client
PUT /oauth_clients/{id}
Optional: allowed_grant_types (arraystring]), allowed_scopes (arraystring]), logo_uri (uri), name (string), policy_uri (uri), redirect_uris (arraystring]), require_pkce (boolean), tos_uri (uri)
rubyoauth_client = client.oauth_clients.update("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") puts(oauth_client)
Returns: allowed_grant_types (arraystring]), allowed_scopes (arraystring]), client_id (string), client_secret (string | null), client_type (enum: public, confidential), created_at (date-time), logo_uri (uri), name (string), org_id (string), policy_uri (uri), record_type (enum: oauth_client), redirect_uris (arraystring]), require_pkce (boolean), tos_uri (uri), updated_at (date-time), user_id (string)
Delete an OAuth client
DELETE /oauth_clients/{id}
rubyresult = client.oauth_clients.delete("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") puts(result)
Retrieve a paginated list of OAuth grants for the authenticated user
GET /oauth_grants
rubypage = client.oauth_grants.list puts(page)
Returns: client_id (string), created_at (date-time), id (uuid), last_used_at (date-time), record_type (enum: oauth_grant), scopes (arraystring])
Retrieve a single OAuth grant by ID
GET /oauth_grants/{id}
rubyoauth_grant = client.oauth_grants.retrieve("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") puts(oauth_grant)
Returns: client_id (string), created_at (date-time), id (uuid), last_used_at (date-time), record_type (enum: oauth_grant), scopes (arraystring])
Revoke an OAuth grant
DELETE /oauth_grants/{id}
rubyoauth_grant = client.oauth_grants.delete("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") puts(oauth_grant)
Returns: client_id (string), created_at (date-time), id (uuid), last_used_at (date-time), record_type (enum: oauth_grant), scopes (arraystring])
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-03 | fail→pass | 7,812 | 5,636 | -28% | 1 | 1 | 0% | 1,472 | 4,176 | +184% | 0 | 0 | — |
case-12 | fail→pass | 10,048 | 2,317 | -77% | 1 | 1 | 0% | 1,823 | 3,476 | +91% | 0 | 0 | — |
case-21 | pass→pass | 10,219 | 5,319 | -48% | 1 | 1 | 0% | 1,892 | 4,038 | +113% | 0 | 0 | — |
case-22 | pass→pass | 11,623 | 31,153 | +168% | 1 | 1 | 0% | 2,312 | 4,317 | +87% | 0 | 0 | — |
case-01 | fail→pass | 7,652 | 5,017 | -34% | 1 | 1 | 0% | 1,614 | 4,134 | +156% | 0 | 0 | — |
case-02 | fail→pass | 10,621 | 7,015 | -34% | 1 | 1 | 0% | 1,966 | 4,523 | +130% | 0 | 0 | — |
case-04 | fail→pass | 11,853 | 3,761 | -68% | 1 | 1 | 0% | 2,237 | 3,858 | +72% | 0 | 0 | — |
case-05 | fail→pass | 8,572 | 3,335 | -61% | 1 | 1 | 0% | 1,574 | 3,612 | +129% | 0 | 0 | — |
case-06 | fail→pass | 10,239 | 2,831 | -72% | 1 | 1 | 0% | 1,913 | 3,683 | +93% | 0 | 0 | — |
case-07 | fail→pass | 11,201 | 3,143 | -72% | 1 | 1 | 0% | 2,125 | 3,648 | +72% | 0 | 0 | — |
case-08 | fail→pass | 13,707 | 3,494 | -75% | 1 | 1 | 0% | 2,433 | 3,698 | +52% | 0 | 0 | — |
case-09 | fail→pass | 9,911 | 2,544 | -74% | 1 | 1 | 0% | 1,809 | 3,489 | +93% | 0 | 0 | — |
case-10 | fail→pass | 15,247 | 4,373 | -71% | 1 | 1 | 0% | 2,736 | 3,993 | +46% | 0 | 0 | — |
case-11 | fail→pass | 10,841 | 3,522 | -68% | 1 | 1 | 0% | 2,059 | 3,794 | +84% | 0 | 0 | — |
case-13 | fail→pass | 9,126 | 2,441 | -73% | 1 | 1 | 0% | 1,885 | 3,586 | +90% | 0 | 0 | — |
case-14 | fail→pass | 10,080 | 3,646 | -64% | 1 | 1 | 0% | 2,025 | 3,835 | +89% | 0 | 0 | — |
case-15 | fail→pass | 6,353 | 2,336 | -63% | 1 | 1 | 0% | 1,295 | 3,528 | +172% | 0 | 0 | — |
case-16 | fail→pass | 7,548 | 1,924 | -75% | 1 | 1 | 0% | 1,397 | 3,405 | +144% | 0 | 0 | — |
case-17 | fail→pass | 7,497 | 2,320 | -69% | 1 | 1 | 0% | 1,604 | 3,553 | +122% | 0 | 0 | — |
case-18 | fail→pass | 11,083 | 4,467 | -60% | 1 | 1 | 0% | 2,202 | 3,875 | +76% | 0 | 0 | — |
case-19 | fail→pass | 11,234 | 5,660 | -50% | 1 | 1 | 0% | 2,030 | 4,130 | +103% | 0 | 0 | — |
case-20 | fail→pass | 10,669 | 2,297 | -78% | 1 | 1 | 0% | 1,813 | 3,436 | +90% | 0 | 0 | — |
case-23 | pass→pass | 25,350 | 7,935 | -69% | 1 | 1 | 0% | 2,208 | 4,680 | +112% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 23 cases were attempted. The headline lift of +87 percentage points is the difference between those two pass rates over the 23 comparable cases.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.