Instantly share code, notes, and snippets.

Embed
What would you like to do?

1mbsite API Documentation

API URL: https://api.1mb.site

Deploy To Your Site

In order to deploy to your site you'll need to send a POST request to the API URL mentioned in the beginning of these docs. This API expects 5 parameters:

Parameters

Parameter About
action deploy
site Your 1mbsite username
key Login at https://account.1mb.site to view
resource Can only contain alphanumeric characters and can't exceed 50 characters in length.
code The code you want to deploy to the page. If any code exists on this page already it'll be replaced.

API Output

You will receive a JSON response. Here's an example request where there's no error:

{
    "error": false,
    "data": false
}

error will be false if you deploy to your site successfully (otherwise it'll be a string)

Here is an example:

{
    "error": "SITE_MISSING",
    "data": false
}

Possible Errors

Error Explanation
SITE_MISSING site parameter missing
ACCOUNT_BANNED self explanatory
ACCOUNT_NONEXISTENT The account doesn't exist
KEY_MISSING key parameter missing
KEY_INCORRECT The key supplied doesn't match the key associated with the account
EMAIL_VERIFICATION You need to verify your email to deploy to your site
KEY_INCLUDED The deployment was blocked because your code contained your site key
RESOURCE_MISSING resource parameter missing
RESOURCE_INVALID resource name can only contain alphanumeric characters
EXTENSION_INVALID resource name can only end in .html, .css, .js, or .json
RESOURCE_LONG resource name can't exceed 50 characters in length
CODE_MISSING code parameter missing
STORAGE_QUOTA You don't have enough storage for this deployment

Verify Your Site Key

In order to verify your site key you'll need to send a POST request to the API URL mentioned in the beginning of these docs. This API expects 3 parameters:

Parameters

Parameter About
action keyverify
username Your 1mbsite username
key Login at https://account.1mb.site to view

API Output

You will receive a JSON response. Here's an example request where there's no error:

{
    "error": false,
    "data": false
}

error will be false if your key was verified successfully (otherwise it'll be a string)

Here is an example:

{
    "error": "USERNAME_MISSING",
    "data": false
}

Possible Errors

Error Explanation
USERNAME_MISSING username parameter missing
KEY_MISSING key parameter missing
KEY_INCORRECT The key supplied doesn't match the key associated with the account

View a Site

In order to view a site you'll need to send a POST request to the API URL mentioned in the beginning of these docs. This API expects 3 parameters:

Parameters

Parameter About
action view
site Site you want to view
resource Resource you want to view

API Output

You will receive a JSON response.

if error is false then data will contain the current site/page code.

Here is an example:

{
    "error": false,
    "data": "<h1>Hello, World!</h1>"
}

error will be false if your key was verified successfully (otherwise it'll be a string)

Here is an example:

{
    "error": "SITE_MISSING",
    "data": false
}

Possible Errors

Error Explanation
SITE_MISSING site parameter missing
SITE_NONEXISTENT site doesn't exist
RESOURCE_MISSING resource parameter missing
RESOURCE_NONEXISTENT resource doesn't exist
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment