NAV Navbar
shell
  • Introduction
  • Authentication
  • Endpoints
  • Permissions
  • Image API (toph)
  • Image generation API (korra)
  • Reputation API (shimakaze)
  • Settings API (tama)
  • Errors
  • Introduction

    Weeb.sh is a service for bot developers that wants to simplify the development and continued hosting of difficult features like reaction images, image generation, bot settings and user reputation (gamification)

    To accomplish that, weeb.sh provides a number of APIs which allow the bot developers to easily implement those features into their bots.

    Authentication

    When calling our API, make sure to add an HTTP-Header with the name of Authorization and a value of TokenType TOKEN

    Weeb.sh requires you to authenticate on most api calls, depending on when you signed up, you may have gotten one of the following tokens:

    Bearer token: eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWUsImlhdCI6MTUxNjIzOTAyMn0.TCYt5XsITJX1CxPCT8yAV-TVkIEq_PbChOMqsLfRoPsnsgw5WEuts01mq-pQy7UJiN5mgRxD-WUcX16dUEMGlv50aqzpqh4Qktb3rk-BuQy72IFLOqV0G_zS245-kronKb78cPN25DGlcTwLtjPAYuNzVBAh4vGHSrQyHUdBBPM

    Wolke token: SDE1STMzd0wtOjBlNjYyYTRmZjg2YWE1OGQwM2FlOTA1YzBhM2FlZGQ1NzZhZjVmMTk2NzE2YWUxNWVjZTVjZWY5

    Bearer token

    # With shell, you can just pass the correct header with each request
    curl "api_endpoint_here"
      -H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWUsImlhdCI6MTUxNjIzOTAyMn0.TCYt5XsITJX1CxPCT8yAV-TVkIEq_PbChOMqsLfRoPsnsgw5WEuts01mq-pQy7UJiN5mgRxD-WUcX16dUEMGlv50aqzpqh4Qktb3rk-BuQy72IFLOqV0G_zS245-kronKb78cPN25DGlcTwLtjPAYuNzVBAh4vGHSrQyHUdBBPM"
    

    For a bearer token the value of the Authorization header would look like this:

    Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWUsImlhdCI6MTUxNjIzOTAyMn0.TCYt5XsITJX1CxPCT8yAV-TVkIEq_PbChOMqsLfRoPsnsgw5WEuts01mq-pQy7UJiN5mgRxD-WUcX16dUEMGlv50aqzpqh4Qktb3rk-BuQy72IFLOqV0G_zS245-kronKb78cPN25DGlcTwLtjPAYuNzVBAh4vGHSrQyHUdBBPM

    Wolke token

    # With shell, you can just pass the correct header with each request
    curl "api_endpoint_here"
      -H "Authorization: Wolke SDE1STMzd0wtOjBlNjYyYTRmZjg2YWE1OGQwM2FlOTA1YzBhM2FlZGQ1NzZhZjVmMTk2NzE2YWUxNWVjZTVjZWY5"
    

    For a wolke token the value of the Authorization header would look like this:

    Wolke SDE1STMzd0wtOjBlNjYyYTRmZjg2YWE1OGQwM2FlOTA1YzBhM2FlZGQ1NzZhZjVmMTk2NzE2YWUxNWVjZTVjZWY5

    Endpoints

    Weeb.sh provides APIs on multiple base endpoints(environments), generally users are unlocked for the staging and production endpoint of an api, but in special cases users may only be unlocked for a single environment/endpoint.

    API endpoints

    Environment URL Purpose
    development http://localhost:API_PORT local development
    staging https://staging.weeb.sh/images/ testing of new features
    production https://api.weeb.sh/images/ production usage

    CDN endpoints

    To serve our assets (images, data, etc.) we also operate the following cdn endpoints:

    Environment URL Purpose
    all https://cdn.weeb.sh serve assets created by services and users

    Permissions

    If a user is missing permissions for an endpoint, they will be seeing a message similar to the following:

    {
        "status": 403,
        "message": "missing scope korra-production:generate_simple"
    }
    

    Weeb.sh APIs use an internal permission model to make sure that users are only allowed to use the endpoints they are whitelisted for. Those permissions are stored using permission keys, which consist of the api-codename, the environment and optionally a key to specify the endpoint/endpoints that may be used: apicodename-environment:key

    Here are some examples:

    toph-production:image_data -> grants a user image_data on toph (images) in the production environment

    toph-staging -> grants all permissions on toph (images) in the staging environment

    Image API (toph)

    This api provides images (reactions, characters, animals) for various categories.

    Codename: toph

    Default permissions:

    Permission name description environment
    image_data Allows you to access basic image data staging
    image_data Allows you to access basic image data production

    Image API CDN Endpoints:

    The image API uses the weeb.sh CDN to provide it's reaction images, depending on the environment of the image API you are using, the base url of the returned image may be one of the following:

    endpoint environment description
    https://cdn.weeb.sh/images production The production CDN endpoint for toph
    https://cdn.weeb.sh/staging-images staging The staging CDN endpoint for toph
    https://cdn.weeb.sh/dev-images development The development CDN endpoint for toph

    Image Object

    Json representation of image object

    {
        "id": "BJZfMrXwb",
        "type": "awoo",
        "baseType": "awoo",
        "nsfw": false,
        "fileType": "gif",
        "mimeType": "image/gif",
        "tags": [],
        "url": "https://cdn.weeb.sh/images/BJZfMrXwb.gif",
        "hidden": false,
        "account": "HyxjFGfPb"
    }
    
    name type description
    id string unique id of the image
    type string type/category of the image, this is what's used to show the list of types in /types
    baseType string ^
    nsfw boolean whether this image has content that could be considered NSFW (not safe for work)
    fileType string file extension of the image
    mimeType string mime type of the image
    tags array of tag objects tags associated with this image
    url string full url used to load the image, you can safely hotlink the image to your site/service
    hidden boolean whether this image can only be seen by the uploader
    ?source string source url of the image
    account string id of the account that uploaded that image

    Upload Image

    Response

    {
    "status":200,
    "file":{
        "id": "BJZfMrXwb",
        "type": "awoo",
        "baseType": "awoo",
        "nsfw": false,
        "fileType": "gif",
        "mimeType": "image/gif",
        "tags": [],
        "url": "https://cdn.weeb.sh/images/BJZfMrXwb.gif",
        "hidden": false,
        "account": "HyxjFGfPb"
        }
    }
    

    Endpoint /images/upload

    Methods POST

    Required Permissions

    Permission name description
    upload_image allows you to upload public and private images
    upload_image_private allows you to upload private images

    Content Types

    Name description
    application/json When uploading images via url
    multipart/form-data When uploading images from disk

    Payload

    name type description
    file File Buffer Buffer containing the image data of the image you want to upload (takes priority over url argument)
    url string Url pointing directly at the image you want to upload, you may only use file or url
    baseType string type of the image, this can be viewed as the category of an image
    hidden boolean If the uploaded image should be hidden
    tags string comma seperated list of tags that should be added to the image, they inherit the hidden property of the image
    nsfw boolean whether this image has content that could be considered NSFW (not safe for work)
    source string Url pointing to the original source of the image

    You will get back a json response with a regular image object wrapped with a file key

    Image types

    Example response

    {
        "status": 200,
        "types": [
            "awoo",
            "bang",
            "blush",
            "clagwimoth"
        ],
        "preview": [
             {
                "url": "https://cdn.weeb.sh/images/BJZfMrXwb.gif",
                "id": "BJZfMrXwb",
                "fileType": "gif",
                "baseType": "awoo",
                "type": "awoo"
            },
            {
                "url": "https://cdn.weeb.sh/images/rJmPWI7wW.gif",
                "id": "rJmPWI7wW",
                "fileType": "gif",
                "baseType": "bang",
                "type": "bang"
            },
            {
                "url": "https://cdn.weeb.sh/images/HklJGIXPW.gif",
                "id": "HklJGIXPW",
                "fileType": "gif",
                "baseType": "blush",
                "type": "blush"
            },
            {
                "url": "https://cdn.weeb.sh/images/HyNYMIXDb.png",
                "id": "HyNYMIXDb",
                "fileType": "png",
                "baseType": "clagwimoth",
                "type": "clagwimoth"
            }
        ]
    }
    

    endpoint /images/types

    methods GET

    required permissions

    Permission name description
    image_data Allows you to access basic image data

    query parameters

    name type description default
    hidden boolean if true, you only get back hidden images you uploaded returns types from public images and hidden images which you uploaded
    nsfw string When false, no types from nsfw images will be returned, true returns types from nsfw and non-nsfw images, only returns only types from nsfw images false
    preview boolean Get a preview image for each type false

    You will get back a list of type strings wrapped in an object similar to this: Preview will contain a list of partial image objects which you can find below. The preview image for a type does not change as long as the image itself isn't deleted.

    Image tags

    Example response

    {
        "status": 200,
        "tags": [
            "nuzzle",
            "cuddle",
            "momiji inubashiri",
            "wan",
            "astolfo",
            "facedesk",
            "everyone"
        ]
    }
    

    endpoint /images/tags

    method GET

    required permissions

    Permission name description
    image_data Allows you to access basic image data

    query parameters

    name type description default
    hidden boolean if true, you only get back hidden tags you added returns public tags and private ones you added
    nsfw string When false, no tags coming from nsfw images will be returned, true returns tags from nsfw and non-nsfw images, only returns only tags from nsfw images false

    returns a list of tags in string format wrapped with a tags key

    Random image

    Example response

    {
        "id": "BJZfMrXwb",
        "type": "awoo",
        "baseType": "awoo",
        "nsfw": false,
        "fileType": "gif",
        "mimeType": "image/gif",
        "tags": [],
        "url": "https://cdn.weeb.sh/images/BJZfMrXwb.gif",
        "hidden": false,
        "account": "HyxjFGfPb"
    }
    

    endpoint /images/random

    method GET

    required permissions

    Permission name description
    image_data Allows you to access basic image data

    query parameters

    name type description default
    type string type of the image you want to get Either Type or Tags is mandatory, but you can combine them -
    tags string comma seperated list of the tags the image should have -
    nsfw string When false, no types from nsfw images will be returned, true returns types from nsfw and non-nsfw images, only returns only types from nsfw images false
    hidden boolean When false you only get public images, true will only give you hidden images uploaded by yourself public images and hidden images you uploaded
    filetype string Filetype of the image, may either be jpg/jpeg, png or gif. jpeg and jpg are treated like being the same. -

    returns a random image

    Image info

    Example response

    {
        "id": "BJZfMrXwb",
        "type": "awoo",
        "baseType": "awoo",
        "nsfw": false,
        "fileType": "gif",
        "mimeType": "image/gif",
        "tags": [],
        "url": "https://cdn.weeb.sh/images/BJZfMrXwb.gif",
        "hidden": false,
        "account": "HyxjFGfPb"
    }
    

    endpoint /info/:image_id

    method GET

    required permissions

    Permission name description
    image_data Allows you to access basic image data

    Gives you the image object for an id

    Add tags to image

    endpoint /info/:image_id/tags

    method POST

    Permission name description
    image_tags Add tags to an image

    Remove tags from image

    endpoint /info/:image_id/tags

    method DELETE

    required permissions

    Permission name description
    image_tags_delete Delete tags from an image

    Delete image

    endpoint /info/:image_id

    method DELETE

    required permissions

    Permission name description
    image_delete Delete images from any user
    image_delete_private Delete hidden images you uploaded

    List images

    endpoint /list

    method GET

    required permissions

    Permission name description
    image_list_all List images from all users

    List images user

    endpoint /list/:account_id

    method GET

    required permissions

    Permission name description
    image_list List images you uploaded
    image_list_all List images from all users

    Image generation API (korra)

    This api provides generated images (love-ship, waifu insult and more) for various purposes.

    Codename: korra

    Generate Simple

    Endpoint /auto-image/generate

    Method GET

    Needed permissions

    Permission name description
    generate_simple Used for simple generations

    Query parameters

    Parameter name Type description default required
    type String type of the generation to create, possible types are listed below x
    face String (Hex Color) only used with awooo type, defines color of face fff0d3
    hair String (Hex Color) only used with awooo type, defines color of hair/fur cc817c

    Types

    awooo:

    awoo image

    eyes:

    eyes image

    won:

    won image

    Discord Status

    Endpoint /auto-image/discord-status

    Method GET

    Needed permissions

    Permission name description
    generate_simple Used for simple generations

    Query parameters

    Parameter name Type description default required
    status String discord status of the mock, has to be one of the states listed below online
    avatar String uri encoded http/s url pointing to an avatar, has to have proper headers and be a direct link to an image green default avatar

    Example discord states

    online

    awoo online

    idle

    awoo idle

    dnd

    awoo dnd

    streaming

    awoo streaming

    offline

    awoo offline

    License generation

    Example payload

    {
        "title":"Spook License",
        "avatar":"https://imgur.com/zPn0DYT.png",
        "badges":[
            "https://imgur.com/zPn0DYT.png",
            "https://imgur.com/zPn0DYT.png",
            "https://imgur.com/zPn0DYT.png"
            ],
        "widgets":["1", "2", "3"]
    }
    

    Endpoint /auto-image/license

    Method POST

    Needed permissions

    Permission name description
    generate_license Used for generating licenses

    Payload

    Name Type description default required
    title String Title of the license x
    avatar String http/s url pointing to an image, has to have proper headers and be a direct link to an image x
    badges String[] Array of http/s urls pointing to images, that should be used in the badges, same conditions as for avatar apply
    widgets String[] Array of strings for filling the three boxes with text content

    Example result

    example license

    Generate Waifuinsult

    Example payload

    {
      "avatar":"https://cdn.discordapp.com/avatars/121919449996460033/d52f23a57dbe54bb39b77d96d61a5a92.webp"
    }
    

    Endpoint /auto-image/waifu-insult

    Method POST

    Needed permissions

    Permission name description
    generate_waifu_insult Used for generating waifuinsults

    Payload

    Name Type description default required
    avatar String http/s url pointing to an image, has to have proper headers and be a direct link to an image x

    Example result

    Waifu Insult demo

    Generate Loveship

    Example payload

    {
      "targetOne": "https://cdn.discordapp.com/avatars/185476724627210241/615ee9f0e97aab7fa0725165531df3a7.webp?size=256",
      "targetTwo": "https://cdn.discordapp.com/avatars/388799526103941121/b5acd5dd89aa8ff7c3600f2b7edaff57.webp?size=256"
    }
    

    Endpoint /auto-image/love-ship

    Method POST

    Needed permissions

    Permission name description
    generate_love_ship Used for generating love ships

    Payload

    Name Type description default required
    targetOne String http/s url pointing to an image, has to have proper headers and be a direct link to an image, image will be on the left side. x
    targetTwo String http/s url pointing to an image, has to have proper headers and be a direct link to an image, image will be on the right side. x

    Example result

    Love Ship demo

    Reputation API (shimakaze)

    This API can be used to assign reputation to a user, while automatically checking for limits such as max reputation a user may give/receive per day as well as the maximum reputation a user may get totally.

    You can also customize those limits to fit your needs. The cooldown of per reputation is also customizable!

    Codename: shimakaze

    Timestamps are always in UTC

    User object

    Json representation of user object

    {
       "reputation":477,
       "cooldown":[
          "2018-03-31T12:05:19.851Z",
          "2018-03-31T12:05:35.008Z"
       ],
       "givenReputation":[
          "2018-04-16T14:16:26.186Z",
          "2018-04-16T14:16:28.062Z"
       ],
       "userId":"186221791792857088",
       "botId":"388799526103941121",
       "accountId":"H1e7U2i8f"
    }
    
    name type description optional
    reputation integer current reputation of user
    cooldown date[] Array of timestamps referring to the last time(s) this user has given reputation to another user
    givenReputation date[] Array of timestamps referring to the last time(s) this user has received reputation from another user
    userId string Id of the user that was passed in the first call to take or give reputation to the user
    botId string Id of the bot that was passed in the first call to take or give reputation to the user
    accountId string Internal id associated with the token calling the API
    availableReputations integer How many reputations the user may give out x
    nextAvailableReputations integer[] Array of timestamps referring to the remaining cooldown time until the user can give out reputation from now x

    Reputation settings object

    Json representation of settings object

    {
       "reputationPerDay":2,
       "maximumReputation":0,
       "maximumReputationReceivedDay":0,
       "reputationCooldown":86400
    }
    
    name type description default
    reputationPerDay integer Number of reputations a user may give out per reputationCooldown 2
    maximumReputation integer The maximum reputation a user may receive 0 (disabled)
    maximumReputationReceivedDay integer The maximum reputation a user may receive per day 0 (disabled)
    reputationCooldown integer Cooldown per reputation, this is set to time in seconds 86400 (1 day)

    Get reputation of user

    Response

    {
        "user": {
            "userId": "128392910574977024",
            "botId": "388799526103941121",
            "accountId": "H1e7U2i8f",
            "givenReputation": [
                "2018-04-17T15:33:44.778Z",
                "2018-04-17T15:33:48.118Z"
            ],
            "cooldown": [
                "2018-04-17T15:33:32.842Z",
                "2018-04-17T15:33:35.415Z"
            ],
            "reputation": 471,
            "availableReputations": 0,
            "nextAvailableReputations": [
                85671127,
                85673700
            ]
        },
        "date": "2018-04-17T15:45:41.675Z",
        "status": 200
    }
    

    Endpoint /reputation/:bot_id/:user_id

    Methods GET

    This endpoint allows you to see the current reputation a user has and when they are able to give out reputation again.

    To be able to compute the time from now until the user can give out reputation again, this endpoint provides you with the fields nextAvailableReputations as well as date.

    Response fields

    name type description
    user User User object with optional fields
    date date Current server time in UTC
    status integer HTTP status code

    Give reputation to user

    Request body

    
    {"source_user":"y"}
    
    

    Response

    {
        "status": 200,
        "date": "2018-04-17T17:03:58.865Z",
        "code": 0,
        "message": "Successfully gave one reputation to the targetUser",
        "sourceUser": {
            "reputation": 6,
            "cooldown": [
                "2018-04-17T17:03:58.864Z"
            ],
            "givenReputation": [
                "2018-04-17T16:17:10.370Z",
                "2018-04-17T16:17:11.758Z"
            ],
            "userId": "y",
            "botId": "x",
            "accountId": "S1WJTqQhf"
        },
        "targetUser": {
            "reputation": 6,
            "cooldown": [
                "2018-04-17T16:29:32.432Z",
                "2018-04-17T16:29:43.303Z",
                "2018-04-17T16:29:44.658Z"
            ],
            "givenReputation": [
                "2018-04-17T16:13:34.916Z",
                "2018-04-17T16:15:17.048Z"
            ],
            "userId": "x",
            "botId": "x",
            "accountId": "S1WJTqQhf"
        }
    }
    

    Error response

    {
        "status": 403,
        "date": "2018-04-17T17:18:26.727Z",
        "code": 1,
        "message": "The user used all of his reputations.",
        "user": {
            "reputation": 6,
            "cooldown": [
                "2018-04-17T17:18:24.614Z",
                "2018-04-17T17:18:25.428Z"
            ],
            "givenReputation": [
                "2018-04-17T16:17:10.370Z",
                "2018-04-17T16:17:11.758Z"
            ],
            "userId": "y",
            "botId": "x",
            "accountId": "S1WJTqQhf"
        }
    }
    

    Endpoint /reputation/:bot_id/:target_user_id

    Methods POST

    This endpoint makes one user (the source user) give one reputation point to the target user.

    It also checks cooldown, as well as maximumReputation, maximumReputationReceivedDay and reputationPerDay.

    Request fields

    name type description
    source_user string Id of source_user

    Response fields

    name type description
    status integer HTTP status code
    date date Current server time in UTC
    code integer Return code, see below for possible errors
    message string Informational message
    sourceUser User User that gave a reputation point
    targetUser User User that received a reputation point

    Error codes

    code HTTP code description user
    0 200 Successful -
    1 403 The user used all of his reputations and hit the cooldown source_user
    2 403 The user received the maximum amount of reputation for today target_user
    3 403 The user reached the maximum possible amount of reputation target_user

    Reset user reputation

    Response

    {
        "user": {
            "reputation": 0,
            "cooldown": [],
            "givenReputation": [
                "2018-04-17T16:13:34.916Z",
                "2018-04-17T16:15:17.048Z"
            ],
            "userId": "x",
            "botId": "x",
            "accountId": "S1WJTqQhf"
        },
        "status": 200
    }
    

    Did a user cheat reputation ? Just reset it!

    Endpoint /reputation/:bot_id/:target_user_id/reset

    Methods POST

    Query parameters

    name type description default
    cooldown boolean Whether to reset the cooldown field of the user too false

    Response fields

    name type description
    user User User object
    status integer HTTP status code

    Increase user reputation

    Request body

    
    {"increase":1}
    
    

    Response

    {
        "user": {
            "reputation": 2,
            "cooldown": [],
            "givenReputation": [
                "2018-04-17T16:13:34.916Z",
                "2018-04-17T16:15:17.048Z",
                "2018-04-17T16:30:27.825Z",
                "2018-04-17T16:30:30.833Z",
                "2018-04-17T16:30:31.401Z",
                "2018-04-17T17:03:58.861Z",
                "2018-04-17T17:18:24.613Z",
                "2018-04-17T17:18:25.427Z",
                "2018-04-17T17:18:26.111Z"
            ],
            "userId": "x",
            "botId": "x",
            "accountId": "S1WJTqQhf"
        },
        "status": 200
    }
    

    Endpoint /reputation/:bot_id/:target_user_id/increase

    Methods POST

    Increases the reputation of the user, useful for automated systems, rewarding a user for voting or for assigning a bought reputation point.

    Request fields

    name type description
    increase integer Increases the reputation of the user by the passed integer

    Response fields

    name type description
    user User User object
    status integer HTTP status code

    Decrease user reputation

    Request body

    
    {"decrease":1}
    
    

    Response

    {
        "user": {
            "reputation": 1,
            "cooldown": [],
            "givenReputation": [
                "2018-04-17T16:13:34.916Z",
                "2018-04-17T16:15:17.048Z",
                "2018-04-17T16:30:27.825Z",
                "2018-04-17T16:30:30.833Z",
                "2018-04-17T16:30:31.401Z",
                "2018-04-17T17:03:58.861Z",
                "2018-04-17T17:18:24.613Z",
                "2018-04-17T17:18:25.427Z",
                "2018-04-17T17:18:26.111Z"
            ],
            "userId": "x",
            "botId": "x",
            "accountId": "S1WJTqQhf"
        },
        "status": 200
    }
    

    Endpoint /reputation/:bot_id/:target_user_id/decrease

    Methods POST

    Decreases the reputation of the user, useful for automated systems, allowing users to "steal" reputation or similar use-cases.

    Request fields

    name type description
    decrease integer Decreases the reputation of the user by the passed integer

    Response fields

    name type description
    user User User object
    status integer HTTP status code

    Get settings

    Response

    {
        "settings": {
            "reputationPerDay": 2,
            "maximumReputation": 0,
            "maximumReputationReceivedDay": 0,
            "reputationCooldown": 86400,
            "accountId": "S1WJTqQhf"
        },
        "status": 200
    }
    

    Endpoint /reputation/settings

    Methods GET

    Allows you to get the currently active settings for your token

    Response fields

    name type description
    settings Settings Settings object
    status integer HTTP status code

    Set settings

    Request body

    {
       "reputationPerDay":5,
       "maximumReputation":0,
       "maximumReputationReceivedDay":0,
       "reputationCooldown":86400
    }
    

    Response

    {
        "settings": {
            "reputationPerDay": 2,
            "maximumReputation": 0,
            "maximumReputationReceivedDay": 0,
            "reputationCooldown": 86400,
            "accountId": "S1WJTqQhf"
        },
        "status": 200
    }
    

    Endpoint /reputation/settings

    Methods POST

    Allows you to update your settings, none of the fields are required.

    Request fields

    name type description default
    reputationPerDay integer Number of reputations a user may give out per reputationCooldown 2
    maximumReputation integer The maximum reputation a user may receive 0 (disabled)
    maximumReputationReceivedDay integer The maximum reputation a user may receive per day 0 (disabled)
    reputationCooldown integer Cooldown per reputation, this is set to time in seconds (must be >= 300) 86400 (1 day)

    Response fields

    name type description
    settings Settings Settings object
    status integer HTTP status code

    Settings API (tama)

    This API can be used to store abitrary settings of your bot like prefix, user settings and more.

    The routes are generally based on the following schema:

    Settings /type/id

    Sub-Settings /type/id/subtype/subid

    You are able to list sub-settings, but unable to list settings.

    With this in mind, you could use routes similar to this:

    /guilds/300407204987666432 -> store guild wide settings

    /guilds/300407204987666432/channels/300407204987666432 -> store settings for a channel

    /guilds/300407204987666432/members/128392910574977024 -> store settings for a member

    Settings object

    Json representation of settings object

    {
       "id":"339114875769061409",
       "type":"guilds",
       "accountId":"H1e7U2i8f",
       "data":{
          "prefix":"poi",
          "smartrec":true
       }
    }
    
    name type description
    id string Id of this setting
    type string Type of this setting
    accountId string Internal id associated with the token calling the API
    data object The user-provided data of this setting

    Sub-Settings object

    Json representation of sub-settings object

    {
       "id":"339114875769061409",
       "type":"guilds",
       "accountId":"HyxjFGfPb",
       "data":{
          "name":"general"
       },
       "subId":"300407204987666432",
       "subType":"channels"
    }
    
    name type description
    id string Id of the parent setting
    type string Type of the parent setting
    accountId string Internal id associated with the token calling the API
    data object The user-provided data of this sub-setting
    subId string Id of this sub-setting
    subType string Type of this sub-setting

    Get setting

    Response

    {
        "status": 200,
        "setting": {
            "id": "339114875769061409",
            "type": "guilds",
            "accountId": "H1e7U2i8f",
            "data": {
                "prefix": "poi",
                "smartrec": true
            }
        }
    }
    

    This endpoint allows you to fetch a setting by type and id.

    Endpoint /settings/:type/:id

    Method GET

    Response fields

    name type description
    setting Setting Setting object
    status integer HTTP status code

    Create/Update setting

    Request body example

    {
       "prefix":"poi",
       "smartrec":true
    }
    

    Response

    {
        "status": 200,
        "setting": {
            "id": "339114875769061409",
            "type": "guilds",
            "accountId": "HyxjFGfPb",
            "data": {
                "prefix": "poi",
                "smartrec": true
            }
        }
    }
    

    This endpoint allows you to create a new setting/update an existing one.

    It overwrites the existing data with the data passed by the user.

    So make sure to include changed and not-changed fields so you don't overwrite anything precious!

    Endpoint /settings/:type/:id

    Method POST

    Request fields

    You may send any kind of json as long as the resulting http request body stays smaller than 10 kilobytes.

    Response fields

    name type description
    setting Setting Setting object
    status integer HTTP status code

    Delete setting

    Response

    {
        "status": 200,
        "message": "Setting deleted",
        "setting": {
            "id": "339114875769061409",
            "type": "guilds",
            "accountId": "HyxjFGfPb",
            "data": {
                "prefix": "awuu"
            }
        }
    }
    

    This endpoint allows you to delete a setting

    Endpoint /settings/:type/:id

    Method DELETE

    Response fields

    name type description
    setting Setting Setting object
    status integer HTTP status code
    message string Informational message

    List sub-settings

    Response

    {
        "status": 200,
        "subsettings": [
            {
                "id": "339114875769061409",
                "type": "guilds",
                "accountId": "HyxjFGfPb",
                "data": {
                    "name": "general"
                },
                "subId": "300407204987666432",
                "subType": "channels"
            }
        ]
    }
    

    This endpoint allows you to get a list of sub-settings for a sub-setting type.

    Endpoint /settings/:type/:id/:subtype

    Method GET

    Response fields

    name type description
    status integer HTTP status code
    subsettings Sub-setting[] Array of subsettings

    Get sub-setting

    Response

    {
        "status": 200,
        "subsetting": {
            "id": "339114875769061409",
            "type": "guilds",
            "accountId": "HyxjFGfPb",
            "data": {
                "name": "general"
            },
            "subId": "300407204987666432",
            "subType": "channels"
        }
    }
    

    This endpoint allows you to get a single sub-setting by it's subId.

    Endpoint /settings/:type/:id/:subtype/:subid

    Method GET

    Response fields

    name type description
    status integer HTTP status code
    subsetting Sub-setting Sub-setting object

    Create/Update sub-setting

    Request body

    {
        "name":"general"
    }
    

    Response

    {
        "status": 200,
        "subsetting": {
            "id": "339114875769061409",
            "type": "guilds",
            "accountId": "HyxjFGfPb",
            "data": {
                "name": "general"
            },
            "subId": "300407204987666432",
            "subType": "channels"
        }
    }
    

    This endpoint allows you to create a new sub-setting/update an existing one.

    It overwrites the existing data with the data passed by the user.

    So make sure to include changed and not-changed fields so you don't overwrite anything precious!

    Endpoint /settings/:type/:id/:subtype/:subid

    Method POST

    Request fields

    You may send any kind of json as long as the resulting http request body stays smaller than 10 kilobytes.

    Response fields

    name type description
    subsetting Sub-Setting Sub-Setting object
    status integer HTTP status code

    Delete sub-setting

    Response

    {
        "status": 200,
        "message": "Subsetting deleted",
        "subsetting": {
            "id": "339114875769061409",
            "type": "guilds",
            "accountId": "HyxjFGfPb",
            "data": {
                "name": "general"
            },
            "subId": "300407204987666432",
            "subType": "channels"
        }
    }
    

    This endpoint allows you to delete a sub-setting

    Endpoint /settings/:type/:id/:subtype/:subid

    Method DELETE

    Response fields

    name type description
    subsetting Sub-Setting Sub-Setting object
    status integer HTTP status code
    message string Informational message

    Errors

    Weeb.sh uses the following error codes:

    Error Code Meaning
    400 Bad Request -- Your request is invalid.
    401 Unauthorized -- Your API key is wrong.
    403 Forbidden -- You don't have permission to use this endpoint.
    404 Not Found -- The specified resource could not be found.
    500 Internal Server Error -- We had a problem with our server. Try again later.
    503 Service Unavailable -- We're temporarily offline for maintenance. Please try again later.