Authentication – ByByBG API Documentation
🔐 Authentication

API Authentication

Securely connect your applications, websites, and backend systems using your private ByByBG API key.

AUTHENTICATION

API Key Authentication

All requests sent to the ByByBG API must include a valid API key inside the request headers.

Your API key identifies your account, request limits, and subscription plan securely.

STEP 1

Generate Your API Key

Login to your dashboard and generate a private API key from the developer settings section.

Important: Never share your API key publicly or expose it in frontend applications.
STEP 2

Send API Key in Request Headers

Include your API key using the X-API-KEY header in every API request.

X-API-KEY: YOUR_API_KEY
PHP EXAMPLE

PHP Authentication Example

Basic PHP example showing how to include your API key in request headers.

<?php

$apiKey = "YOUR_API_KEY";

$headers = [
    "X-API-KEY: ".$apiKey
];
CURL EXAMPLE

cURL Authentication Example

Simple authenticated cURL request example for testing the API quickly.

curl -X POST https://api.bybybg.com/v1/remove-bg \
-H "X-API-KEY: YOUR_API_KEY" \
-F "file=@image.png"
SECURITY

Security Best Practices

  • Never expose API keys in frontend JavaScript code.
  • Store API keys securely in environment variables.
  • Rotate your API keys periodically for better security.
  • Use backend proxy systems for frontend applications.
  • Restrict unauthorized access to your backend systems.
COMMON MISTAKES

Common Authentication Mistakes

  • Using an invalid or expired API key.
  • Sending requests without authentication headers.
  • Exposing secret API keys publicly on websites.
  • Using incorrect header names or formatting.
ERRORS

Authentication Errors

Status
Description
401
Missing or invalid API key.
403
Access denied for this API request.
429
Rate limit exceeded for your account.

Ready for API Integration?

Continue to the Web / HTML integration guide and build your first AI background remover application.