Authentication

Authentication

To make requests to the Swooply API, you need to authenticate yourself with an API key. At the moment, you can get one by contacting our team via Discord

⚠️

It is crucial to keep your API key secure as it carries many privileges. Do not share your secret API key in publicly accessible areas such as GitHub, client-side code, or any other public forum. 

All API requests must be made over HTTPS (opens in a new tab) to ensure secure communication. Calls made over plain HTTP will fail, and API requests without authentication will also fail. 

To authenticate your requests, you will need to include your API key in the x-api-key header of your HTTP request. The following code blocks demonstrate how to establish a connection to our API using it. 

const WebSocket = require("ws");
 
const url = "wss://api.swooply.co/websocket";
 
const headers = {
  "x-api-key": "YOUR_API_KEY",
  "Content-Type": "application/json"
};
 
const socket = new WebSocket(url, {
  headers
});

By including your API key in the x-api-key header and ensuring that your requests are made over HTTPS, you can ensure that your requests are authenticated and securely transmitted. This protects your sensitive data and prevents unauthorized access. 

Remember to always keep your API key secure and to only use it in authorized requests to protect your Swooply account and data.