Search⌘ K

API Model for LeetCode Service

Understand the LeetCode API model by exploring its base URL, core service endpoints such as user registration, problem queries, and contest submissions. Learn how data entities and message formats enable communication between client and backend services, laying a foundation for effective API design.

This lesson models the LeetCode API by discussing its base URL, the endpoints of various services, the data entities, and the messages exchanging these data entities to fulfill different user requests. The design considerations from the preceding lesson will inform our API modeling.

Base URL and API endpoints

The following is the base URL of the LeetCode service:

Base URL for the LeetCode service
Base URL for the LeetCode service

We’ll use api.leetcode.com as the host URL for requesting distinct LeetCode services.

The endpoints for each operation are defined against the respective service in the following diagram. You can view the remaining endpoints by unfolding each service.

API endpoints for LeetCode service

Below, we discuss the endpoints of each service individually:

  • User service: The /register, /login, and /profile endpoints in user service handle user registration, login, and view profile requests, respectively.

  • ...