STiBaRC API Documentation
The official API for the STiBaRC social media service
Endpoints
- https://api.stibarc.com/v4/
Note: API versions prior to v4 have been discontinued and will no longer work. Please upgrade your application to v4.
All endpoints accept POST and take a Content-Type of application/json
If an endpoint accepts GET as well, it can also take any post body property as a URL parameter.
Table of Contents
Methods
getannouncement.sjs
Get the current announcement on the site
Allowed methods: GET
Returns:
- status: string: "ok" | "error"
- errorCode?: string: "ise"
- error?: string: The error message, if one occurred
- announcement: string: The current site announcement
uploadfile.sjs
Upload a file to the site
Note: Parameters are passed as headers for this method, and the file is uploaded in the post body
Allowed methods: POST
Required headers:
- X-Session-Key: string: The session key of the user uploading the file
- X-File-Usage: string: "attachment" | "pfp" | "banner"
Post body: File to be uploaded
Returns:
Authentication
registeruser.sjs
Register a new user to the site
Allowed methods: POST
Required parameters:
- username: string: The username of the new user
- password: string: The password of the new user
Optional parameters:
- name: string: The real name of the user
- email: string: The email of the user
- birthday: Date: The birthday of the user
- bio: string: The bio to display on the user's profile
- displayName: boolean: Whether to display the user's real name on their profile
- displayEmail: boolean: Whether to display the user's email on their profile
- displayBirthday: boolean: Whether to display the user's birthday on their profile
- displayBio: boolean: Whether to display the user's bio on their profile
Returns:
- status: string: "ok" | "error"
- errorCode?: string: "rnp" | "rmpb" | "rnup" | "ue" | "ise"
- error?: string: The error message, if one occurred
- session?: string: A session key for the new user, if no errors were encountered
login.sjs
Log into the site
Allowed methods: POST
Required parameters:
- username: string: The username of the user
- password: string: The password of the user
Optional parameters:
- totpCode: string: The TOTP code, if required
Returns:
- status: string: "ok" | "error"
- errorCode?: string: "rnp" | "rmpb" | "rnup" | "totpr" | "iuop" | "itotp" | "ise"
- error?: string: The error message, if one occurred
- session?: string: A session key for the user, if no errors were encountered
- username?: string: The user's username
- pfp?: string: The URL to the user's profile picture
logout.sjs
Log out of the site
Allowed methods: POST
Required parameters:
- session: string: The session you want to log out
Returns:
- status: string: "ok" | "error"
- error?: string: "rnp" | "rmpb" | "rns" | "is" | "ise"
- error?: string: The error message, if one occurred
updatepassword.sjs
Update the user's password
Allowed methods: POST
Required parameters:
- session: string: The session of the user to update the password of
- oldPassword: string: The old password of the user
- newPassword: string: The new password for the user
Optional parameters:
- logoutOthers: boolean: Whether to log out all other sessions (exept this one)
Returns:
manage2fa.sjs
Manage two factor authentication on an account
Allowed methods: POST
Required parameters:
- session: string: The session of the user
- state: string: "generatetotp" | "enabletotp" | "disabletotp"
Optional parameters:
- totpCode: string: The current TOTP code
Returns:
Manipulating Users
getuser.sjs
Get a user's profile
Allowed methods: GET, POST
Required parameters:
- username: string: The username of the user to get
Returns:
- status: string: "ok" | "error"
- errorCode?: string: "rngp" | "rmpb" | "rnu" | "unf" | "ise"
- error?: string: The error message, if one occurred
- user?: Object: Info about the user {
id: string: The ID of the user,
username: string: The username of the user,
joinedDate: Date: When the user joined STiBaRC,
lastLoggedIn: Date: When the user last logged in,
lastPostedDate: Date: When the user last posted,
banned: boolean: If the user is banned,
pfp: string: URL to the user's profile picture,
verified: boolean: If the user is verified,
name: string: The user's real name,
email: string: The user's email,
birthday: Date: The user's birthday,
bio: string: The user's bio,
displayName: boolean: If the name should be displayed,
displayEmail: boolean: If the email should be displayed,
displayBirthday: boolean: If the birthday should be displayed,
displayBio: boolean: If the bio should be displayed,
rank: string: The user's rank,
followers: Object[]: {
username: string: The follower's username,
pfp: string: The follower's pfp,
verified: boolean: If the follower is verified,
banned: boolean: If the follower is banned
},
following: Object[]: {
username: string: The followed user's username,
pfp: string: The followed user's pfp,
verified: boolean: If the followed user is verified,
banned: boolean: If the followed user is banned
},
posts: Object[]: Info about the user's posts [
{
id: number: The ID of the post,
deleted: boolean: If the post has been deleted,
poster: Object: Info about the poster {
username: string: The username of the poster,
pfp: string: URL to the poster's profile picture,
verified: boolean: If the poster is verified,
banned: boolean: If the poster is banned
},
postDate: Date: When the post was made,
edited: boolean: If the post has been edited,
lastEdited: Date: When the post was last edited,
title: string: The title of the post,
content: string: The content of the post,
attachments: string[]: Array of URLs to attachments,
comments: number: The number of comments on the post,
upvotes: number: The number of upvotes on the post,
downvotes: number: The number of downvotes on the post
}
],
comments: Object[]: Info about the user's comments [
{
post: Object: {
id: number: The ID of the post,
title: string: The title of the post,
poster: Object: Info about the poster {
username: string: The username of the poster,
pfp: string: URL to the poster's profile picture,
verified: boolean: If the poster is verified,
banned: boolean: If the poster is banned
}
},
comment: Object: {
id: number: The ID of the comment,
deleted: boolean: If the comment has been deleted,
poster: Object: Info about the poster {
username: string: The username of the poster,
pfp: string: URL to the poster's profile picture,
verified: boolean: If the poster is verified,
banned: boolean: If the poster is banned
},
date: Date: When the comment was posted,
edited: boolean: If the comment has been edited,
lastEdited: Date: When the comment was last edited,
content: string: The content of the comment,
attachments: string[]: Array of URLs to attachments
}
}
],
block: string[8][8]: A thing,
displayBlock: boolean: If the user's block should be displayed
}
getprivatedata.sjs
Get a user's private data
Allowed methods: POST
Required parameters:
- session: string: The session of the user to get private data from
Returns:
- status: string: "ok" | "error"
- errorCode?: string: "rnp" | "rmpb" | "rns" | "is" | "ise"
- error?: string: The error message, if one occurred
- user?: Object: Private info about the user {
id: string: The id of the user,
username: string: The username of the user,
totpEnabled: boolean: If TOTP is enabled,
joinedDate: Date: When the user joined,
lastLoggedIn: Date: When the user last logged in,
registrationIP: string: The IP address used to register with,
lastLoginIP: string: The IP address that last logged in,
banned: boolean: If the user is banned,
pfp: string: The profile picture of the user,
name: The user's real name,
email: The user's email,
birthday: Date: The user's birthday,
bio: string: The user's bio,
sessions: Object[]: [{
id: string: The unique id of the session,
username: string: Username of the user,
loginIP: string: IPv4 or IPv6 address the user originally used to log in with,
loginDate: Date: The date the user logged in,
permissions: string[]: Array of permissions the session has. Can be "post", "comment", "vote", "editprofile", and "viewprivate",
userAgent: string: The browser user agent that logged in
}],
displayName: If the user's real name should be displayed,
displayEmail: If the user's email should be displayed,
displayBirthday: If the user's birthday should be displayed,
displayBio: If the user's bio should be displayed,
block: string[8][8]: A thing,
displayBlock: boolean: If the user's block should be displayed
}
editprofile.sjs
Edit a user's profile
Allowed methods: POST
Required parameters:
- session: string: The session of the user to edit the profile of
Optional parameters:
- pfp: string: A URL to the user's profile picture,
- banner: string: A URL to the user's banner
- name: string: The user's real name,
- email: string: The user's email,
- birthday: Date: The user's birthday,
- bio: string: The user's bio,
- displayName: boolean: If the user's real name should be displayed,
- displayEmail: boolean: If the user's email should be displayed,
- displayBirthday: boolean: If the user's birthday should be displayed,
- displayBio: boolean: If the user's bio should be displayed,
- block: string[8][8]: A thing,
- displayBlock: boolean: If the user's block should be displayed
Returns:
followuser.sjs
Follow a user
Allowed methods: POST
Required parameters:
- session: string: The session of the user following
- username: string: The username of the user to be followed
Returns:
Interacting With Posts
getposts.sjs
Get a list of posts in order
Allowed methods: GET, POST
Optional parameters:
- postsToReturn: number: Number of posts for each section to return at max
- returnTotalPosts: boolean: If the total number of posts on STiBaRC should be returned
- returnGlobal: boolean: If the global posts should be returned
- returnFollowed: boolean: If the user's followed user posts should be returned. Requires the session parameter.
- lastSeenGlobalPost: number: The ID of the last seen global post (where to continue the list from)
- lastSeenFollowedPost: number: The ID of the last seen followed post (where to continue the list from)
- session: string: The session of the user
Returns:
- status: string: "ok" | "error"
- errorCode?: string: "ise"
- error?: string: The error message, if one occurred
- totalPosts: number: The total number of posts on STiBaRC
- globalPosts: Object[]: The list of global posts [
{
id: number: The ID of the post,
deleted: boolean: If the post has been deleted,
poster: Object: Info about the poster {
username: string: The username of the poster,
pfp: string: URL to the poster's profile picture,
verified: boolean: If the poster is verified,
banned: boolean: If the poster is banned
},
postDate: Date: When the post was made,
edited: boolean: If the post has been edited,
lastEdited: Date: When the post was last edited,
title: string: The title of the post,
content: string: The content of the post,
attachments: string[]: Array of URLs to attachments,
comments: number: The number of comments on the post,
upvotes: number: The number of upvotes on the post,
downvotes: number: The number of downvotes on the post
}
]
- followedPosts: Object[]: The list of followed posts [
{
id: number: The ID of the post,
deleted: boolean: If the post has been deleted,
poster: Object: Info about the poster {
username: string: The username of the poster,
pfp: string: URL to the poster's profile picture,
verified: boolean: If the poster is verified,
banned: boolean: If the poster is banned
},
postDate: Date: When the post was made,
edited: boolean: If the post has been edited,
lastEdited: Date: When the post was last edited,
title: string: The title of the post,
content: string: The content of the post,
attachments: string[]: Array of URLs to attachments,
comments: number: The number of comments on the post,
upvotes: number: The number of upvotes on the post,
downvotes: number: The number of downvotes on the post
}
]
getpost.sjs
Get an individual post
Allowed methods: GET, POST
Required parameters:
- id: number: The ID of the post to get
Returns:
- status: string: "ok" | "error"
- errorCode?: string: "rngp" | "rmpb" | "rni" | "pnfod" | "ise"
- error?: string: The error message, if one occurred
- post?: Object: The post {
id: number: The ID of the post,
deleted: boolean: If the post has been deleted,
poster: Object: Info about the poster {
username: string: The username of the poster,
pfp: string: URL to the poster's profile picture,
verified: boolean: If the poster is verified,
banned: boolean: If the poster is banned
},
postDate: Date: When the post was made,
contentHistory: Object[]: The history of content in the post [
{
edited: boolean: If the post has been edited,
lastEdited: Date: The last time the post was edited,
title: string: The title of the post,
content: string: The content of the post,
attachments: string[]: Array of URLs pointing to attachments,
deleted: boolean: If the post has been deleted
}
],
edited: boolean: If the post has been edited,
lastEdited: Date: The last time the post was edited,
title: string: The title of the post,
content: string: The content of the post,
attachments: string[]: Array of URLs pointing to attachments,
comments: Object[]: The comments on the post [
{
id: number: The ID of the comment,
deleted: boolean: If the comment has been deleted,
poster: Object: Info about the poster {
username: string: The username of the poster,
pfp: string: URL to the poster's profile picture,
verified: boolean: If the poster is verified,
banned: boolean: If the poster is banned
},
date: Date: When the comment was posted,
edited: boolean: If the comment has been edited,
lastEdited: Date: When the comment was last edited,
contentHistory: Object[]: [
{
edited: boolean: If the comment has been edited,
lastEdited: Date: The last time the comment was edited,
content: string: The content of the comment,
attachments: string[]: Array of URLs pointing to attachments,
deleted: boolean: If the comment has been deleted
}
],
content: string: The content of the comment,
attachments: string[]: Array of URLs pointing to attachments,
upvotes: number: The number of upvotes,
downvotes: number: The number of downvotes
}
],
upvotes: number: The number of upvotes,
downvotes: number: The number of downvotes
}
vote.sjs
Vote on a post or comment
Allowed methods: POST
Required parameters:
- session: string: Session of the user to vote with
- id: number: ID of the post
- target: string: "post" | "comment"
- vote: string: "upvote" | "downvote"
Optional parameters:
- commentId: number: ID of the comment to vote on, required when target == "comment"
Returns:
- status: string: "ok" | "error"
- errorCode?: string: "rnp" | "rmpb" | "rns" | "rni" | "rit" | "riv" | "rnci" | "cnfod" | "pnfod" | "isvp" | "banned" | "is" | "ise"
- error?: string: The error message, if one occurred
- action?: string: "upvoted" | "downvoted" | "removed upvote" | "removed downvote"
- upvotes: number: The number of upvotes on the target
- downvotes: number: The number of downvotes on the target
search.sjs
Search posts, comments, and users on the site
Allowed methods: POST
Required parameters:
- query: string: The search query
Returns:
- status: string: "ok" | "error"
- errorCode?: string: | "ise"
- error?: string: The error message, if one occurred
- users?: Object[]: Array of users matching the query [
{
id: string: The ID of the user,
username: string: The username of the user,
joinedDate: Date: When the user joined,
lastLoggedIn: Date: When the user last logged in,
lastPostedDate: Date: When the user last posted,
banned: boolean: If the user is banned,
pfp: string: URL to the user's profile picture,
verified: boolean: If the user is verified,
name: string: The user's real name,
email: string: The user's email,
birthday: Date: The user's birthday,
bio: string: The user's bio,
displayName: boolean: If the user's real name should be displayed,
displayEmail: boolean: If the user's email should be displayed,
displayBirthday: boolean: If the user's birthday should be displayed,
displayBio: boolean: If the user's bio should be displayed,
rank: string: The user's rank,
followers: string[]: Array of users following this user,
following: string[]: Array of users this user is following,
posts: number[]: Array of post IDs this user has made,
comments: Object[]: Array of comments this user has made [
{
postId: number: ID of the post this comment is on
commentId: number: ID of the comment
}
],
block: string[8][8]: A thing,
displayBlock: boolean: If the user's block should be displayed
}
]
- posts?: Object[]: Array of posts (or posts with comments) matching the query [
{
id: number: ID of the post,
deleted: boolean: If the post has been deleted,
poster: Object: Info about the poster {
username: string: The username of the poster,
pfp: string: URL to the poster's profile picture,
verified: boolean: If the poster is verified,
banned: boolean: If the poster is banned
},
postDate: Date: When the post was made,
edited: boolean: If the post has been edited,
lastEdited: Date: When the post was last edited,
title: string: The title of the post,
content: string: The content of the post,
attachments: string[]: Array of URLs pointing to attachments,
comments: number: The number of comments on the post,
upvotes: number: The number of upvotes on the post,
downvotes: number: The number of downvotes on the post
}
]
Manipulating Posts
newpost.sjs
Make a new post
Allowed methods: POST
Required parameters:
- session: string: The session of the user posting
- title: string: The title of the post
- content: string: The content of the post
Optional parameters:
- attachments: string[]: Array of URLs pointing to attachments
Returns:
Post a new comment on a post
Allowed methods: POST
Required parameters:
- session: string: The session of the user commenting
- id: number: The ID of the post to comment on
At least one of the following parameters is required:
- content: string: The content of the comment
- attachments: string[]: Array of URLs pointing to attachments
Returns:
edit.sjs
Edit a post or comment
Allowed methods: POST
Required parameters:
- session: string: Session of the user
- id: number: ID of the post
- target: string: "post" | "comment"
Optional parameters:
- commentId: number: ID of the comment to edit. Required when target == "comment"
- title: string: New title of the post
- content: string: New content of the post/comment
- attachments: string[]: New array of URLs pointing to attachments
- deleted: boolean: Set to true to delete post/comment
Returns:
Error Codes
- banned: User is banned
- chill: Rate limited; only one post/comment per 10 seconds
- cnfod: The requested comment does not exist or has been deleted
- dtotp: Disable TOTP first
- etotp: Enable TOTP first
- ftb: Uploaded file is too big
- gtotp: Generate TOTP first
- ip: Invalid password
- is: Invalid session
- iscp: Session does not have "comment" permission
- ise: Internal server error
- isep: Session does not have "editprofile" permission
- ispp: Session does not have "post" permission
- istate: Invalid state property
- isvp: Session does not have "vote" permission
- itotp: Invalid TOTP code
- iuop: Invalid username or password
- nfu: No file uploaded
- pnfod: The requested post does not exist or has been deleted
- rit: Request must have a valid target property
- riv: Request must have a valid vote property
- rmpb: Request must have a body with the Content-Type of application/json
- rnc: Request must have a content property
- rnci: Request must have a commentId property
- rncoa: Request must have a content or attachments property
- rnfuh: Request must have an X-File-Usage header
- rngp: Request must be a GET or POST request
- rni: Request must have an id property
- rnnp: Request must have a newPassword property
- rnop: Request must have an oldPassword property
- rnp: Request must be a POST request
- rnq: Request must have a query parameter/property
- rns: Request must have a session property
- rnsh: Request must have an X-Session-Key header
- rnstate: Request must have a state property
- rnt: Request must have a title property
- rnu: Request must have a username property
- rnup: Request must have a username and password property
- totpag: TOTP already generated
- totpr: TOTP code required
- udnoc: User does not own comment
- udnop: User does not own post
- ue: User already exists
- ufsh: Unacceptable X-File-Usage header
- uft: Unacceptable uploaded file type
- unf: The requested user does not exist