Overview

Introduction

Infinity API is REST-based, returns JSON-encoded responses, and uses standard HTTP verbs, status codes, and authentication.

Authentication

Infinity API authentication is token-based. Authentication is passed in the Authorization header with a value set to Bearer token.

We're in the process of implementing OAuth Authorization Code Grant to allow integration with third-party applications. In the mean time, you can use Personal Access Tokens to access your data.

important

Your Access Token can give access to your private data and should be treated like a password. Keep them secure and never share with anyone, or other third-party applications.

Personal Access Tokens never expired. If you think someone have access to any of your tokens, you should immediately revoke them and generate new ones.

All API requests must be addressed to api.infinity.health, and made over HTTPS. Calls made over plain HTTP will fail.

Requests that require authentication will return 404 Not Found, instead of 403 Forbidden, in some places. This is to prevent the accidental leakage of private repositories to unauthorized users.

Authenticating with invalid credentials will return 401 Unauthorized.

Encoding

Data is encoded as defined by JSON in RFC 8259. The default encoding for APIs is UTF-8. Certain characters may be handled as surrogate unicode pairs.

HTTP verbs

Request methods are used in accordance with HTTP. Where possible, Infinity API strives to use appropriate HTTP verbs for each action.

VerbDescription
GETUsed for retrieving resources
POSTUsed for creating resources
PUTUsed for updating resources
DELETEUsed for removing resources

Responses use standard HTTP codes. Where there are client or server errors, a list of one or more errors in JSON format is returned in the body.

The API may send cache directives where suitable, notably the ETag, Last-Modified and If-Modified-Since headers.

The Accept header must be used by a client used. Requests without an Accept header of application/json may be rejected with a client error of 406 Not Acceptable.

Responses and errors

Infinity API borrows some hints from the JSON:API specification. Responses are JSON objects containing either the data or error key. They never coexist within the same object.

The data key is returned in a successful response. It's either a single object, the value null, or an array of objects. Which can be empty.

For successful responses, Infinity may return, in addition to 200 OK, statuses 201 Created, 202 Accepted, or 204 No Content.

The error key represents client or server errors. It's an Error object with the following keys:

KeyDescriptionType
idUnique machine-readable identifierString
statusHTTP status codeInteger
titleA human-readable message providing more details about the errorString
detailOptional object with extra information about the errornull or object

Infinity 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. Codes in the 5xx range indicate an API error.

Errors summary

IDStatusTitle
unauthorized401Unauthorized
forbidden403Forbidden
not_found404Not found
invalid_parameters422Invalid parameters
api_error500API error