API Requests

Overview

You can make requests to the ittybit API using any HTTP client.

const response = await fetch(`https://api.ittybit.com/files`);

The Ittybit API uses standard HTTP verbs to perform actions on resources:

  • GET requests are used to retrieve resources from the API.

  • POST requests are used to create new resources.

  • DELETE requests are used to remove resources.

We also use PUT and PATCH for updating resources:

  • PUT is used to wholly replace an existing resource.

  • PATCH is used to perform partial updates to a resource.


Don't want to make HTTP requests?

We provide SDKs for typescript, python, ruby, go, and php.


Request Bodies

POST, PUT, and PATCH endpoints accept JSON-encoded request bodies.

const response = await fetch(`https://api.ittybit.com/files`, {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    url: "https://ittyb.it/sample.mp4",
  }),
});

To avoid issues with double-encoding, we recommend setting the Content-Type header to application/json in your requests.


Security

The Ittybit API uses API Keys to authenticate requests.

You should pass your API Key in the Authorization header of your requests. The value should be prefixed with Bearer followed by a space and then your key e.g. Bearer sk_test_abcdefg....

const response = await fetch(`https://api.ittybit.com/files`, {
  headers: {
    Authorization: `Bearer ${ITTYBIT_API_KEY}`,
  },
});

API requests without authentication, or with an invalid API Key, will fail.

Your API Keys give privileged access to your project resources so they should be kept secret. Be careful not to share them in publicly accessible areas such as GitHub, client-side code, etc.

You can view and manage your keys in the Ittybit Webapp.


Environments

It is recommended to setup separate projects (within a single org) for each of your development and production environments, and to create different API Keys for each environment.

This will allow you to separate your test and production media.


HTTPS

API requests must be made over HTTPS.

Calls made over plain HTTP will fail.


Character Encoding

To avoid issues with character encoding, please ensure that your requests are made with UTF-8 encoding.

On this page