Authentication overview

Pinball Map's API provides access to a database of pinball machine locations, current availability, and related event information. Authentication mechanisms are designed to differentiate between non-commercial and commercial usage, ensuring appropriate access control and resource allocation. Non-commercial use typically relies on straightforward methods, while commercial applications involve bespoke agreements and potentially more complex authentication protocols.

The system is built on a RESTful architecture, where each request to a protected endpoint must include valid credentials. Properly authenticating ensures that your application can retrieve the necessary data without exceeding rate limits or violating terms of service. Understanding the specific authentication requirements for your use case is critical for successful integration with the Pinball Map API.

Supported authentication methods

Pinball Map offers different authentication approaches depending on the intended use case:

  • API Keys: This is the primary method for non-commercial applications. An API key is a unique identifier provided to developers, which is then included in each request to verify the client's identity. This method is suitable for read-only access to public data.
  • IP Whitelisting: For certain non-commercial applications, or as a supplementary security measure, Pinball Map may allow IP whitelisting. This restricts API access to requests originating from a predefined set of IP addresses, adding a layer of network-level security.
  • Commercial Licensing Specifics: Commercial use of the Pinball Map API requires direct negotiation and a licensing agreement. Authentication methods for commercial partners are defined within these agreements, which may include custom API keys, OAuth 2.0 flows, or other enterprise-grade authentication solutions tailored to the partner's infrastructure and security needs. Information on OAuth 2.0 can be found through the OAuth 2.0 specification documentation.

Authentication methods comparison

Method When to use Security level
API Key Non-commercial projects, public data access Moderate (key secrecy is paramount)
IP Whitelisting Non-commercial, fixed server environments, supplementary security Moderate-High (requires control over source IPs)
Commercial Licensing Protocols Commercial applications, high-volume, sensitive data, custom integrations High (negotiated, can include OAuth 2.0, enterprise SSO)

Getting your credentials

The process for obtaining credentials varies based on your intended use:

  1. For Non-Commercial Use (API Key):

    To obtain an API key for non-commercial purposes, you typically need to:

    1. Visit the Pinball Map API documentation page.
    2. Look for a section on API key requests or developer registration.
    3. Follow the instructions to register your application or contact the Pinball Map team to request a key. This often involves providing details about your project and agreeing to the terms of service for non-commercial use.
    4. Once approved, your API key will be provided to you. It is crucial to treat this key as sensitive information and protect it from unauthorized access.
  2. For IP Whitelisting:

    If IP whitelisting is required or offered for your non-commercial project, you would typically:

    1. Contact Pinball Map support or follow specific instructions in their documentation regarding IP whitelisting.
    2. Provide the static public IP addresses from which your application will make API requests.
    3. Pinball Map will then configure their systems to allow traffic from these specified IPs.
  3. For Commercial Use (Licensing Agreement):

    For any commercial application, the process begins with engaging directly with the Pinball Map team:

    1. Contact Pinball Map via their contact page or the dedicated commercial licensing section on their website.
    2. Discuss your specific commercial needs, expected API usage, and integration requirements.
    3. Negotiate a licensing agreement that will outline the terms of service, pricing, and the specific authentication mechanisms to be used (e.g., custom API keys, OAuth 2.0 client credentials, or other methods).
    4. Upon agreement, Pinball Map will provide the necessary credentials and documentation tailored to your commercial license.

Authenticated request example

For non-commercial use with an API key, authentication is typically handled by including the key in the request header or as a query parameter. While the Pinball Map documentation may provide specific examples, a common pattern involves an X-API-KEY header:

GET /api/v1/locations HTTP/1.1
Host: pinballmap.com
X-API-KEY: YOUR_API_KEY_HERE
Accept: application/json

Alternatively, the API key might be passed as a query parameter:

GET /api/v1/locations?api_key=YOUR_API_KEY_HERE HTTP/1.1
Host: pinballmap.com
Accept: application/json

Replace YOUR_API_KEY_HERE with your actual API key. Always refer to the official Pinball Map API documentation for the precise method of passing your credentials.

Security best practices

Protecting your authentication credentials is paramount to maintaining the security and integrity of your application and complying with Pinball Map's terms of service. Implement the following best practices:

  • Keep API Keys Confidential: Never hardcode API keys directly into public client-side code (e.g., JavaScript in a browser). They should be stored securely on a server, in environment variables, or in a secrets management system.
  • Use Environment Variables: Store API keys and other sensitive credentials as environment variables on your server or container orchestration platform. This prevents them from being committed to source control and exposed.
  • Secure Communication: Always use HTTPS/TLS for all API requests to encrypt data in transit and prevent eavesdropping. This is a fundamental security practice for any web service interaction, as highlighted by the Mozilla Developer Network's guide on secure contexts.
  • Implement Least Privilege: If different API keys or access tokens can be granted varying levels of permission, ensure that your application only uses credentials with the minimum necessary permissions to perform its functions.
  • Rotate Credentials: Periodically rotate your API keys. If a key is compromised, rotating it limits the window of exposure. Specific rotation policies should be guided by your organization's security posture and Pinball Map's recommendations.
  • Monitor API Usage: Regularly review your API usage logs for any unusual activity that might indicate unauthorized access or compromise of your credentials.
  • IP Whitelisting (When Available): If Pinball Map supports IP whitelisting for your use case, leverage it to restrict access to only your authorized server IP addresses, adding a layer of network security.
  • Error Handling: Implement robust error handling for authentication failures. Avoid returning verbose error messages that could inadvertently expose information about your authentication mechanism.
  • Stay Updated: Keep up-to-date with any security advisories or best practice recommendations provided by Pinball Map regarding their API and authentication methods.