Skip to content

TeachableV1

Defined in: v1/index.ts:26

The v1 Teachable API client. Manages authentication, base URL configuration, and provides access to all v1 resource endpoints via typed sub-clients.

Instantiated automatically by TeachableClient — you should not need to create this directly.

Consumers should not instantiate this class directly. Use TeachableClient instead, which initializes this automatically. Direct instantiation is only necessary in advanced scenarios.

new TeachableV1(apiKey, enableDebug?): TeachableV1

Defined in: v1/index.ts:53

Creates a new TeachableV1 instance, validates the API key, and initializes all resource sub-clients with the shared fetch layer.

string

Your Teachable API key. Required — throws if empty or missing.

boolean = false

If true, logs all outgoing requests and responses to the console. Defaults to false.

TeachableV1

If apiKey is not provided.

courses: CoursesAPI

Defined in: v1/index.ts:32

Provides access to course-related API operations.


pricingPlans: PricingPlansAPI

Defined in: v1/index.ts:41

Provides access to pricing plan-related API operations.


transactions: TransactionsAPI

Defined in: v1/index.ts:35

Provides access to transaction-related API operations.


users: UsersAPI

Defined in: v1/index.ts:29

Provides access to user-related API operations.


webhooks: WebhooksAPI

Defined in: v1/index.ts:38

Provides access to webhook-related API operations.

getRaw(endpoint, logOutput?): Promise<any>

Defined in: v1/index.ts:120

Sends a raw, unvalidated GET request to any v1 endpoint. Useful for exploring undocumented endpoints or debugging API responses without schema validation.

Logs the request URL and full response body when debug mode is active (either via enableDebug on the constructor, or the logOutput parameter).

string

The API endpoint path (e.g. /enrollments), appended to the base URL.

boolean = false

If true, forces request/response logging for this call regardless of enableDebug. Defaults to false.

Promise<any>

A promise resolving to the raw, unparsed JSON response.

If the response status is not OK, including the status code.

// Explore an endpoint without a schema
const raw = await client.v1.getRaw('/enrollments', true);