Overview
The 2A-FFL API is the most accessible API for retrieving data from the Federal Firearms Licenses (FFL) database, allowing users to search by location or license number. It provides a seamless way to access up-to-date licensing information for businesses and individuals involved in firearms sales and distribution.
To access the FFL API, you need a monthly subscription and an API key. You can subscribe and obtain your key here: FFL API Subscription.
Authentication & Headers
To access the FFL API, you need a monthly subscription and an API key. You can subscribe and obtain your key here: FFL API Subscription.
To authenticate with the API, include the following HTTP headers in each request:
X-API-KEY: <Your_Base64_Encoded_API_Key> Origin: https://myauthorized.domain.com Content-Type: application/json Accept: application/json
Header Explanations:
X-API-KEY: Your API key is provided as a UUID but must always be Base64 encoded before being sent. Only the encoded version of the key should be included in the request.
PHP: base64_encode($apiKey); Node: Buffer.from(apiKey).toString('base64'); Python: base64.b64encode(api_key.encode('utf-8')) Go: base64.StdEncoding.EncodeToString([]byte(apiKey)) Bash: echo -n $API_KEY | base64
Origin: This is the domain linked to your API key. Each API key can be associated with only one domain, which will be permanently bound to the key upon executing the activation request. The activation request process is detailed below.
API Key Activation
Before making any requests, your API key must be activated. This only needs to be done once.
The activation process registers the request origin domain as the authorized domain for the key.
Endpoint
GET /api/keys/activate
Successful Response (200 OK)
{ "status": "ok", "data": { "message": "Key `8eb39d25_xxxx_xxxx_xxxx_xxxxxxxxxxxx` has been activated" }, "meta": [] }
Once this request is successfully completed and you receive a successful response, you can securely use your API key to access the most up-to-date and comprehensive FFL database.
Key Status Verification
You can check the current status of your API key to ensure it is active and valid.
Endpoint
GET /api/keys/status
Successful Response (200 OK)
{ "status": "ok", "data": { "message": "Your key is currently active and valid." }, "meta": [] }
Error Responses
- 400 Bad Request: The key has been authorized on a different domain.
{ "status": "error", "data": { "message": "The key `8eb39d25_xxxx_xxxx_xxxx_xxxxxxxxxxxx` has been authorized on a different domain. To update your authorized domain for the key, please get in touch with our support team." }, "meta": [] }
- 401 Unauthorized: Invalid API Key.
{ "status": "error", "data": { "message": "Invalid API Key. If this is unexpected, please get in touch with our support team." }, "meta": [] }
Retrieving FFL Information
Search FFLs by Zip Code and Radius
This endpoint retrieves a list of Federal Firearms License holders (FFLs) within a given radius of a specified zip code.
Endpoint
GET /api/ffl
Query Parameters
Parameter | Description |
---|---|
zipcode | USPS Zip Code (Required) |
radius | Radius in miles (Required) |
types | Comma-separated list of FFL License Types (Optional) |
Example Request
GET /api/ffl?zipcode=33875&radius=5
Successful Response (200 OK)
{ "status": "ok", "data": [ { "id": 23427, "license_number": "1-59-55-1-5A-6020", "license_name": "HEARTLAND FIREARMS INC", "street_address": "10282 PAYNE ROAD", "city": "SEBRING", "state": "FL", "zip_code": "33875", "phone": "8635592443", "latitude": "27.389726", "longitude": "-81.481951", "distance": 1.6 } ], "meta": { "query": { "zipcode": "33875", "radius": 5 } } }
Error Responses
- 400 Bad Request: The key is authorized on a different domain.
- 401 Unauthorized: Invalid API Key.
Retrieve an FFL by ID
Fetch detailed information about a specific FFL using its unique ID.
Endpoint
GET /api/ffl/<id>
Query Parameters
Parameter | Description |
---|---|
include | Comma-separated list of relationships to include (e.g., info) |
Example Request
GET /api/ffl/23427
Successful Response (200 OK)
{ "status": "ok", "data": { "id": 23427, "license_number": "1-59-55-1-5A-6020", "license_name": "HEARTLAND FIREARMS INC", "street_address": "10282 PAYNE ROAD", "city": "SEBRING", "state": "FL", "zip_code": "33875", "phone": "8635592443", "latitude": "27.389726", "longitude": "-81.481951" } }
Retrieve an FFL by License Number
Look up an FFL using its license number.
Endpoint
GET /api/ffl/license/<ffl-license>
Query Parameters
Parameter | Description |
---|---|
include | Comma-separated list of relationships to include (e.g., info) |
Example Request
GET /api/ffl/license/1-59-55-1-5A-6020
Successful Response (200 OK)
{ "status": "ok", "data": { "id": 23427, "license_number": "1-59-55-1-5A-6020", "license_name": "HEARTLAND FIREARMS INC", "street_address": "10282 PAYNE ROAD", "city": "SEBRING", "state": "FL", "zip_code": "33875", "phone": "8635592443", "latitude": "27.389726", "longitude": "-81.481951" } }
For any issues, please contact the 2A-FFL support team (support@2acommerce.com).