Blue Collar Firemen API

v1.0
Base URL: https://api.bluecollarfiremen.com

Overview

The Blue Collar Firemen API provides user authorization management for platform integrations. This API allows you to add and remove access to our content platform for your users.

Base URL

https://api.bluecollarfiremen.com

Content Type

application/json

Authentication

All API requests require authentication using an API key sent in the request headers.

Security Notice

Keep your API key secure and never expose it in client-side code.

Required Header

X-API-Key: your_api_key_here

Need API Access?

If you're looking to get API access for your users, please reach out to support@bluecollarfiremen.com

Endpoints

POST

/user

Add user access to the platform. Creates a user if they don't exist and assigns access.

Request Body

{
  "user_email": "user@example.com",
  "user_name": "John Doe"
}
Parameters
Field Type Required Description
user_email string Required User's email address
user_name string Optional User's display name

Response

Success (201 Created)
{
  "message": "User created and access assigned successfully",
  "user_id": 12345,
  "access_id": 67890
}
Success (200 OK)
{
  "message": "Existing user found with existing access",
  "user_id": 12345,
  "access_id": 67890
}
DELETE

/user

Remove user access from the platform. Revokes their permission to view content.

Request Body

{
  "user_email": "user@example.com"
}
Parameters
Field Type Required Description
user_email string Required user's email address

Response

Success (200 OK)
{
  "message": "Access revoked successfully",
  "user_id": 12345,
  "access_id": 67890
}
POST

/user/login

Generate an SSO (Single Sign-On) login URL for an existing user. This endpoint creates a secure, tokenized URL that allows users to access the platform without entering credentials.

Request Body

{
  "user_email": "user@example.com"
}
Parameters
Field Type Required Description
user_email string Required Email address of the user to generate login URL for

Response

Success (200 OK)
{
  "url": "https://app.bluecollarfiremen.com/sso/login?token=abc123xyz"
}

The returned URL is time-limited and single-use for security purposes.

Security Requirements

User must exist and have active access. Login URLs are time-limited and single-use only.

Error Codes

Status Code Error Description
400 Bad Request Missing required user_email field
401 Unauthorized Invalid or missing API key
403 Forbidden User doesn't have access
404 Not Found User not found
405 Method Not Allowed Only POST and DELETE methods are supported (/user), only POST for /user/login
500 Internal Server Error Server error processing the request

Code Examples

cURL

Add user

curl -X POST https://api.bluecollarfiremen.com/user \
  -H "Content-Type: application/json" \
  -H "X-API-Key: your_api_key_here" \
  -d '{
    "user_email": "user@example.com",
    "user_name": "John Doe"
  }'

Remove user

curl -X DELETE https://api.bluecollarfiremen.com/user \
  -H "Content-Type: application/json" \
  -H "X-API-Key: your_api_key_here" \
  -d '{
    "user_email": "user@example.com"
  }'

Generate SSO login URL

curl -X POST https://api.bluecollarfiremen.com/user/login \
  -H "Content-Type: application/json" \
  -H "X-API-Key: your_api_key_here" \
  -d '{
    "user_email": "user@example.com"
  }'

JavaScript (Fetch)

Add user

const response = await fetch('https://api.bluecollarfiremen.com/user', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'X-API-Key': 'your_api_key_here'
  },
  body: JSON.stringify({
    user_email: 'user@example.com',
    user_name: 'John Doe'
  })
});

const result = await response.json();
console.log(result);

Remove user

const response = await fetch('https://api.bluecollarfiremen.com/user', {
  method: 'DELETE',
  headers: {
    'Content-Type': 'application/json',
    'X-API-Key': 'your_api_key_here'
  },
  body: JSON.stringify({
    user_email: 'user@example.com'
  })
});

const result = await response.json();
console.log(result);

Generate SSO login URL

const response = await fetch('https://api.bluecollarfiremen.com/user/login', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'X-API-Key': 'your_api_key_here'
  },
  body: JSON.stringify({
    user_email: 'user@example.com'
  })
});

const result = await response.json();
console.log(result.url); // Use the URL to redirect user