Skip to main content

Account setup

Setting up the account to use the API.

Setting up

Creating an account

To create an account, navigate to here.

Following the conclusion of the registration steps, take note of the username, password, subdomain and the affiliate id that is generated.

The username and password are used to generate an access token.

Screenshots of the process provided below:

Signup Part 1 Signup Part 2

Security

Your username, password, and affiliate id are tied directly to your account.

It is highly recommended to use environment variables and a .gitignore when working with the API to prevent these sensitive credentials from becoming available in the public eye.

Getting an access token and refresh token

To recieve an access token and refresh token, the /auth route will be used.

The access token will have an expiration time of 15 minutes, however the refresh token will have a much longer expiration time.

The route will return an access token, token type, and refresh token.

Below are examples on using this route.

Curl example

curl --header "Content-Type: application/json" \ --request POST \ --data '{"user_name": "user1234", "password": "password1234"}' \ https://quinix.byteconnect.us/auth

Python example

import requests
from os import getenv

username = getenv("username")
password = getenv("password")
body = {"username" : username, "password" : password}

url = getenv("bytefederal_api_url")

request = requests.post(f"{url}/auth", json=body)
response = request.json()
print(response)

NodeJS example

async function Auth() {
const username = process.env.USERNAME;
const password = process.env.PASSWORD;
const bodyData = {
username,
password
}
const url = `${process.env.BYTECONNECTURL}/auth`;
const request = await fetch(url, {
method: "POST",
body=JSON,stringify(bodyData),
headers: {
"Content-Type": "application/json"
}
}
);
const response = await request.json();
console.log(response);
}

HTTP Codes

200

Returns a JSON encoded response of an access token, the token type, and the refresh token.

401

Username or password was invalid.