-
Notifications
You must be signed in to change notification settings - Fork 10
API Docs
The API for nekos.cafe is pretty simple as long as you know how HTTP works.
https://nekos.cafe/api/info - GET
This endpoint provides information about the API, such as total files, if invite mode is on, or if admin signups are enabled, this is mainly for the frontend to decide to hide or unhide certain elements as they may not be needed. Example below.
{
"inviteonly": true,
"adminreg": false,
"totalfiles": 63,
"uploadURL": "https://i.nekos.cafe/",
"maxuploadsize": "100"
}
https://nekos.cafe/api/user/info - POST
This endpoint requests the header token
which contains the token of the user, it returns the username and the file count associated with the user. Example below.
{
"username": "Moptop",
"filecount": 36
}
https://nekos.cafe/api/user/signup - POST
This endpoint lets the user create an account. It requires the headers username
, password
, and optionally regkey
if invite-only mode is enabled. It returns a message which says "Success!". The token is returned at the /api/token/get endpoint.
https://nekos.cafe/api/user/delete - POST
This endpoint deletes the user account, all files associated with the account are purged and all traces are deleted. The endpoint requires the headers username
, and password
. Token is not used due to security issues.
The response should be "This user has been deleted" if the user was successfully purged.
https://nekos.cafe/api/user/passreset - POST
This endpoint is for resetting a user password, it requires the headers username
, password
, newpassword
. The endpoint will respond with "The password has been reset!" on success. This will not regenerate the token, it is just for resetting the password.
https://nekos.cafe/api/token/get - POST
This endpoint is for getting your user token, the required headers are username
, password
. It will return your token if the values are valid.
{
"token": "xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
}
https://nekos.cafe/api/token/regen - POST
This endpoint is for regenerating your token, it requires the header token
. If the token is valid it will return "Token has been regenerated!" and your token will be regenerated.
https://nekos.cafe/api/token/valid - POST
This endpoint is for verifying if the token is valid or not, it is mainly used for the frontend and serves no other purpose. If the token is valid it will send "This token is valid!"
https://nekos.cafe/api/files/list - POST
This endpoint is for listing all files uploaded by the user, it requires the header token
.
[
"file1.png",
"file2.png".
"file3.png"
]
https://nekos.cafe/api/files/upload - POST
This endpoint is for uploading files, it requires the header token
. Uploads are handled with multipart data usually used in forms. The input field for this endpoint is called uploadFile
. If the post is successful it will return the url of the new file.
{
"url": "https://i.nekos.cafe/xxxxxxx.png"
}
https://nekos.cafe/api/files/delete - POST
This endpoint is for deleting files for the user, it requires the headers token
, and file
. The file header must contain a valid filename that belongs to the user. If the file is successfuly deleted it will return "xxxxxxx.png has been deleted!"
https://nekos.cafe/api/admin/signup - POST
This is for registering admins. The required headers are username
, password
, and adminkey
. If the admin is created it will return "Success!"
https://nekos.cafe/api/admin/regkeygen - POST
This endpoint is for creating regkeys. Regkeys are registration keys which are used for invite-only instances of nekos.cafe. The required headers are token
.
{
"regkey": "xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
}
https://nekos.cafe/api/admin/token/valid - POST
This endpoint is for validating admin tokens, the required header is token
, if thie is successful it should return "This token is valid!"
https://nekos.cafe/api/admin/token/get - POST
This endpoint is for getting admin token. The required headers are username
, password
.
{
"token": "xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
}
https://nekos.cafe/api/admin/list/uploads - POST
This endpoint is for getting a list of all uploads and users associated with the files. The required headers are token
, query
. Query must be the EXACT name of the file, this is useful for things such as DMCA takedowns. If you want to list all files without a query set query to " " in your request.
[
{
file: "ksjOX5O.png",
username: "user1"
},
{
file: "WzeAnNp.js",
username: "user2"
}
]
https://nekos.cafe/api/admin/list/users - POST
This endpoint is for getting a list of all users, the required headers are token
, query
. Query must be the EXACT name of the user. If you want to list all files without a query set query to " " in your request.
[
"user1",
"user2"
]
https://nekos.cafe/api/admin/delete/file - POST
This endpoint is for deleting a file. The required headers are token
, file
. If this was successful it should return a message like "xxxxxxx.png has been deleted!"
https://nekos.cafe/api/admin/delete/user - POST
This endpoint is for deleting a user and all of the users files. The required headers are username
, token
. If this is successful it should return "This user has been deleted"