Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Cohere ai Cohere python CreateConnectorOAuth Model

From Leeroopedia
Knowledge Sources
Domains SDK, Connectors, OAuth
Last Updated 2026-02-15 14:00 GMT

Overview

CreateConnectorOAuth is a Pydantic model used as the request body for specifying OAuth 2.0 authentication when creating a new connector.

Description

The CreateConnectorOAuth model provides all the fields needed to configure OAuth 2.0 authentication for a new connector. Unlike ConnectorOAuth (which represents the read-only view of an existing connector's OAuth configuration), all fields in CreateConnectorOAuth are optional, allowing partial OAuth configuration during connector creation. The fields include:

  • client_id -- The OAuth 2.0 client ID, encrypted at rest.
  • client_secret -- The OAuth 2.0 client secret, encrypted at rest and never returned in API responses.
  • authorize_url -- The OAuth 2.0 /authorize endpoint URL for user authorization.
  • token_url -- The OAuth 2.0 /token endpoint URL for exchanging authorization codes for tokens.
  • scope -- The OAuth scopes to request during authorization.

Usage

Use CreateConnectorOAuth when creating a new connector with OAuth 2.0 authentication via the Cohere connectors API. Pass an instance of this model as the oauth parameter when calling the create connector endpoint.

Code Reference

Source Location

Signature

class CreateConnectorOAuth(UncheckedBaseModel):
    client_id: typing.Optional[str] = pydantic.Field(default=None)
    client_secret: typing.Optional[str] = pydantic.Field(default=None)
    authorize_url: typing.Optional[str] = pydantic.Field(default=None)
    token_url: typing.Optional[str] = pydantic.Field(default=None)
    scope: typing.Optional[str] = pydantic.Field(default=None)

Import

from cohere.types import CreateConnectorOAuth

I/O Contract

Fields

Field Type Required Description
client_id Optional[str] No The OAuth 2.0 client ID. Encrypted at rest.
client_secret Optional[str] No The OAuth 2.0 client secret. Encrypted at rest and never returned in responses.
authorize_url Optional[str] No The OAuth 2.0 /authorize endpoint URL for user authorization.
token_url Optional[str] No The OAuth 2.0 /token endpoint URL for exchanging authorization codes.
scope Optional[str] No The OAuth scopes to request when users authorize the connector.

Usage Examples

from cohere.types import CreateConnectorOAuth

# Create a connector with OAuth 2.0 authentication
oauth_config = CreateConnectorOAuth(
    client_id="my-oauth-client-id",
    client_secret="my-oauth-client-secret",
    authorize_url="https://provider.example.com/oauth/authorize",
    token_url="https://provider.example.com/oauth/token",
    scope="read write",
)

connector = client.connectors.create(
    name="My Data Source",
    url="https://my-search-api.example.com/search",
    oauth=oauth_config,
)

print(f"Created connector: {connector.id}")

# Create a connector with partial OAuth configuration
partial_oauth = CreateConnectorOAuth(
    authorize_url="https://provider.example.com/oauth/authorize",
    token_url="https://provider.example.com/oauth/token",
)

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment