https://github.com/kerolloz/codeforces-api-ts
Codeforces-API-TS is a NodeJS Client Library for Codeforces API with Typescript support
https://github.com/kerolloz/codeforces-api-ts
codeforces codeforces-api codeforces-sdk typescript
Last synced: 11 months ago
JSON representation
Codeforces-API-TS is a NodeJS Client Library for Codeforces API with Typescript support
- Host: GitHub
- URL: https://github.com/kerolloz/codeforces-api-ts
- Owner: kerolloz
- License: mit
- Created: 2023-01-05T22:26:17.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2025-02-19T23:15:00.000Z (12 months ago)
- Last Synced: 2025-03-29T10:36:37.198Z (11 months ago)
- Topics: codeforces, codeforces-api, codeforces-sdk, typescript
- Language: TypeScript
- Homepage:
- Size: 144 KB
- Stars: 7
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://www.npmjs.com/package/codeforces-api-ts)
[](https://www.npmjs.com/package/codeforces-api-ts)

Codeforces-API-TS is a NodeJS Client Library for [Codeforces API](http://codeforces.com/apiHelp) with Typescript support 💙
> **Note**
> Source code in this repo is heavily inspired by [ahmed-dinar/codeforces-api-node](https://github.com/ahmed-dinar/codeforces-api-node).
## Install
```sh
npm install codeforces-api-ts
```
## Usage
```typescript
import { CodeforcesAPI } from "codeforces-api-ts";
(async () => {
CodeforcesAPI.setCredentials({
API_KEY: "your-api-key",
API_SECRET: "your-api-secret",
});
// all methods return a promise
await CodeforcesAPI.call("blogEntry.comments", { blogEntryId: 79 });
await CodeforcesAPI.call("blogEntry.view", { blogEntryId: 79 });
await CodeforcesAPI.call("contest.hacks", { contestId: 566 });
await CodeforcesAPI.call("contest.list", {});
await CodeforcesAPI.call("contest.ratingChanges", { contestId: 566 });
await CodeforcesAPI.call("contest.standings", { contestId: 566 });
await CodeforcesAPI.call("contest.status", { contestId: 566 });
await CodeforcesAPI.call("problemset.problems", {});
await CodeforcesAPI.call("problemset.recentStatus", { count: 10 });
await CodeforcesAPI.call("recentActions", { maxCount: 10 });
await CodeforcesAPI.call("user.blogEntries", { handle: "kerolloz" });
await CodeforcesAPI.call("user.friends", {}); // requires authorization
await CodeforcesAPI.call("user.info", { handles: "kerolloz" });
await CodeforcesAPI.call("user.ratedList", {});
await CodeforcesAPI.call("user.rating", { handle: "kerolloz" });
await CodeforcesAPI.call("user.status", { handle: "kerolloz" });
})();
```
## API
The source code is well documented. I tried to make it as simple as possible and followed the same conventions as the official API. You can simply hover over the method name to see the description of the method and its parameters.
You can find function defentions and types in [src/types.ts](src/types.ts)
### Methods & Parameters
>Full description of the API can be found on .
| Method | Parameters |
| ---------------------------------------------------------------------------------------- | ------------------------------------------------------------ |
| [blogEntry.comments](http://codeforces.com/apiHelp/methods#blogEntry.comments) | **\*blogEntryId** |
| [blogEntry.view](http://codeforces.com/apiHelp/methods#blogEntry.view) | **\*blogEntryId** |
| [contest.hacks](http://codeforces.com/apiHelp/methods#contest.hacks) | **\*contestId** |
| [contest.list](http://codeforces.com/apiHelp/methods#contest.list) | gym |
| [contest.ratingChanges](http://codeforces.com/apiHelp/methods#contest.ratingChanges) | **\*contestId** |
| [contest.standings](http://codeforces.com/apiHelp/methods#contest.standings) | **\*contestId**, from, count, handles, room, showUnofficial |
| [contest.status](http://codeforces.com/apiHelp/methods#contest.status) | **\*contestId**, handle, from, count |
| [problemset.problems](http://codeforces.com/apiHelp/methods#problemset.problems) | tags, problemsetName |
| [problemset.recentStatus](http://codeforces.com/apiHelp/methods#problemset.recentStatus) | **\*count**, problemsetName |
| [recentActions](http://codeforces.com/apiHelp/methods#recentActions) | **\*maxCount** |
| [user.blogEntries](http://codeforces.com/apiHelp/methods#user.blogEntries) | **\*handle** |
| [user.friends](http://codeforces.com/apiHelp/methods#user.friends) | onlyOnline |
| [user.info](http://codeforces.com/apiHelp/methods#user.info) | **\*handles** |
| [user.ratedList](http://codeforces.com/apiHelp/methods#user.ratedList) | activeOnly, includeRetired, contestId |
| [user.rating](http://codeforces.com/apiHelp/methods#user.rating) | **\*handle** |
| [user.status](http://codeforces.com/apiHelp/methods#user.status) | **\*handle**, from, count |
>*required parameters
### Authorization
The only method that requires authorization is `user.friends`. To authorize your requests you need to set your API_KEY and API_SECRET using the `setCredentials` method.
You can get your API key from .
### Return Data
Data is returned in JSON format. For full description of data format visit .