Udemy Affiliate API Documentation (v2.0)
Getting Started
Access to the Affiliate API on Udemy will be discontinued by 1/1/2025. To access the Affiliate API please review our instructions on joining the Udemy Affiliate Program.
The Udemy Affiliate API exposes a lot of functionalities of Udemy to help developers build client applications and integrations with Udemy.
It is organized around REST. Our API is designed to have predictable, resource-oriented URLs and to use HTTP response codes to indicate API errors. We use built-in HTTP features, like HTTP authentication and HTTP verbs, which can be understood by off-the-shelf HTTP clients. We only accept https
calls to the API. All responses will be returned in JSON format, including errors. OAuth 2 protocol is used for user authorization (not documented yet).
Udemy Affiliate API is currently at version 2.0 and the root endpoint is https://www.udemy.com/api-2.0/
for all resources.
Creating an Affiliate API Client
To make any calls to Udemy REST API, you will need to create an API client. Affiliate API client consists of a bearer token
, which is connected to a user account on Udemy.
If you want to create an Affiliate API client, Sign up on www.udemy.com and go to API Clients page in your user profile. Once your Affiliate API client request is approved, your newly created Affiliate API client will be active and your bearer token
will be visible on API Clients page.
Sending an Authenticated Request
Udemy Affiliate API requires basic authentication parameters to validate the client. The auth parameters have to be sent in every call or you will get a 401 UNAUTHORIZED
error.
To send authenticated requests, provide the client_id
and client_secret
values as a base64 encoded HTTP Authorization
header.
curl --user {YOUR_CLIENT_ID}:{YOUR_CLIENT_SECRET} https://www.udemy.com/api-2.0/courses/
curl -H "Authorization: Basic {BASE64_ENCODED(CLIENT_ID:CLIENT_SECRET)}" https://www.udemy.com/api-2.0/courses/
Use of Fields and Field Lists
Udemy Affiliate API supports an optional request parameterfields
to customize which fields should be returned for a particular object type. Fields parameter is a hash map which is usually defined as get parameters like fields[course]
, fields[user]
etc... Each object type also has field lists @min
, @default
, and @all
.
Examples
Return the course object with title and headline fields
https://www.udemy.com/api-2.0/courses/238934/?fields[course]=title,headline
Return the course object with all fields in @min, plus the owner, but exclude the images. For the user object only return the title field
https://www.udemy.com/api-2.0/courses/238934/?fields[course]=@min,owner,-images&fields[user]=title
Pagination
Most of our apis return paginated responses. You can change the page size by specifying the page_size
query parameter. The default page size is 12. The maximum page size is 100. You can change the page by specifying the page
query parameter.
Error Responses
Udemy API uses conventional HTTP response codes to indicate success or failure of an API request. In general, codes in the 2xx
range indicate success, codes in the 4xx
range indicate an error that resulted from the provided information (e.g. a required parameter was missing, a charge failed, etc.), and codes in the 5xx
range indicate an error with our servers.