# API Reference

The Sleekplan API is organized around REST. Our API has predictable resource-oriented URLs, accepts form-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes and authentication.

You can use the Sleekplan API for operations within your Sleekplan product (e.g. read, create, update, or delete posts and changelog updates). The API key you use to authenticate the request determines whether the request is made by you.

Base url


# Authentication

The Sleekplan API uses API key to authenticate requests. You can view and manage your API keys in the Sleekplan Dashboard.

Your API key carry many privileges, so be sure to keep them secure! Do not share your secret API key in publicly accessible areas such as GitHub, client-side code, and so forth. Authentication to the API is performed via HTTP Basic Auth. Provide your API key as the basic auth username value. You do not need to provide a password. You can also provide the API key with an URL parameter ?api_key=96323866321ab812adf3509b1b436af5dac2b9a47.

If you need to authenticate via bearer auth (e.g., for a cross-origin request), use -H "Authorization: Bearer 96323866321ab812adf3509b1b436af5dac2b9a47" instead of -u 96323866321ab812adf3509b1b436af5dac2b9a47. All API requests must be made over HTTPS. Calls made over plain HTTP will fail. API requests without authentication will also fail.

curl https://api.sleekplan.com/v1/posts \
  -u 96323866321ab812adf3509b1b436af5dac2b9a47:


A sample API key is included in all the examples here, which is not usable for making requests. To test requests using your account, replace the sample API key with your actual API key.

# Errors

Sleekplan uses conventional HTTP response codes to indicate the success or failure of an API request. In general: Codes in the 2xx range indicate success. Codes in the 4xx range indicate an error that failed given the information provided (e.g., a required parameter was omitted, a charge failed, etc.). Codes in the 5xx range indicate an error with Sleekplans's servers (these are rare).

Success response: a successful query returns a json string with status "success" and data, which contains the resturned data.

    "status": "success",
    "data": {...}

Error response: an unsuccessful query returns a json string with status "error" and an error message.

    "status": "error",
    "message": "Error message ..."

In addition to the returned json string Sleekplan uses conventional HTTP response codes to indicate the success or failure of an API request.

HTTP Status Code Data Description
OK 200 - Everything worked as expected.
Bad Request 400 - The request was unacceptable, often due to missing a required parameter.
Unauthorized 401 - No valid API key provided.
Request Failed 402 - The parameters were valid but the request failed.
Forbidden 403 - The API key doesn't have permissions to perform the request.
Not Found 404 - The requested resource doesn't exist.