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.
Remarks
Section titled “Remarks”Consumers should not instantiate this class directly. Use TeachableClient instead, which initializes this automatically. Direct instantiation is only necessary in advanced scenarios.
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”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.
Parameters
Section titled “Parameters”apiKey
Section titled “apiKey”string
Your Teachable API key. Required — throws if empty or missing.
enableDebug?
Section titled “enableDebug?”boolean = false
If true, logs all outgoing requests and responses to the console. Defaults to false.
Returns
Section titled “Returns”TeachableV1
Throws
Section titled “Throws”If apiKey is not provided.
Properties
Section titled “Properties”courses
Section titled “courses”courses:
CoursesAPI
Defined in: v1/index.ts:32
Provides access to course-related API operations.
pricingPlans
Section titled “pricingPlans”pricingPlans:
PricingPlansAPI
Defined in: v1/index.ts:41
Provides access to pricing plan-related API operations.
transactions
Section titled “transactions”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
Section titled “webhooks”webhooks:
WebhooksAPI
Defined in: v1/index.ts:38
Provides access to webhook-related API operations.
Methods
Section titled “Methods”getRaw()
Section titled “getRaw()”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).
Parameters
Section titled “Parameters”endpoint
Section titled “endpoint”string
The API endpoint path (e.g. /enrollments), appended to the base URL.
logOutput?
Section titled “logOutput?”boolean = false
If true, forces request/response logging for this call regardless of enableDebug. Defaults to false.
Returns
Section titled “Returns”Promise<any>
A promise resolving to the raw, unparsed JSON response.
Throws
Section titled “Throws”If the response status is not OK, including the status code.
Example
Section titled “Example”// Explore an endpoint without a schemaconst raw = await client.v1.getRaw('/enrollments', true);