Getting started overview

To begin using the Brave NewCoin API, developers typically follow a sequence of steps starting with account registration and API key acquisition. The API provides access to historical and real-time cryptocurrency data, suitable for applications ranging from digital asset research to algorithmic trading strategies. Brave NewCoin offers a Developer Plan that includes limited access to endpoints and requests for initial exploration and development.

The core products accessible via the API include the Digital Asset Data API, the BLX (BNC Liquid Index), and BNC-FI (Fixed Income Indices). The platform emphasizes comprehensive API documentation and provides SDKs for common programming languages like Python and JavaScript, aiming to streamline the integration process for developers seeking to incorporate digital asset information into their projects.

This guide focuses on the initial setup, including account creation, obtaining API credentials, and making a first successful API call. This foundational understanding is crucial for subsequent development, such as implementing more complex data queries or integrating the data into trading platforms.

Quick reference table

Step What to do Where
1. Create Account Register for a Brave NewCoin developer account. Brave NewCoin Developer Page
2. Get API Keys Generate and securely store your API key and secret. Developer Dashboard (after login)
3. Review Documentation Understand the API structure, endpoints, and authentication. Brave NewCoin API Reference
4. Make First Request Construct and execute a basic API call using your credentials. Your preferred development environment (e.g., cURL, Python SDK)

Create an account and get keys

Access to the Brave NewCoin API requires a registered account. Follow these steps to set up your account and retrieve the necessary API credentials:

  1. Navigate to the Developer Portal: Begin by visiting the official Brave NewCoin developer page. This portal is the central hub for all developer-related information, including documentation and sign-up options.
  2. Register for an account: Look for a 'Sign Up' or 'Get Started' option. You will typically need to provide an email address, create a password, and agree to the terms of service. Brave NewCoin's compliance with GDPR standards suggests a focus on data privacy during this process.
  3. Verify your email: After registration, a verification email will be sent to the address you provided. Click the link in this email to activate your account and proceed to the developer dashboard.
  4. Generate API Keys: Once logged into your developer dashboard, locate the section for API Keys or Credentials. This is where you will generate your unique API key and API secret. It is critical to store these credentials securely, as they grant access to your account's API usage and data. Brave NewCoin's documentation emphasizes that API keys should be treated as sensitive information, similar to passwords.
  5. Understand Rate Limits: Before making requests, review the rate limits associated with your plan. The Developer Plan has specific limitations on the number of requests per minute or hour. Exceeding these limits can result in temporary blocks or errors.

The API key is used to authenticate your requests, ensuring that only authorized applications can access the data. Some endpoints may require additional authentication using the API secret, often involving signing requests, a common practice described in authentication standards like OAuth 2.0.

Your first request

After obtaining your API keys, the next step is to make a successful API call. This example demonstrates how to fetch a list of available cryptocurrencies using a common REST client, cURL, and then provides examples using the Python and JavaScript SDKs.

Using cURL (HTTP Request)

This example assumes you have an API key (YOUR_API_KEY) and an API secret (YOUR_API_SECRET) and will fetch a list of digital assets. Refer to the Brave NewCoin API reference for specific endpoint details.

curl -X GET \
  'https://api.bravenewcoin.com/v2/market/assets' \
  -H 'X-BNC-ApiKey: YOUR_API_KEY' \
  -H 'Accept: application/json'

Replace YOUR_API_KEY with your actual API key. This request targets the /v2/market/assets endpoint, which typically returns a list of supported digital assets. A successful response will be a JSON object containing asset data.

Using Python SDK

First, install the Brave NewCoin Python SDK:

pip install bravenewcoin

Then, use the following Python code to make a request:

from bnc_sdk import BraveNewCoinClient

# Initialize the client with your API key and secret
client = BraveNewCoinClient(
    api_key="YOUR_API_KEY",
    api_secret="YOUR_API_SECRET"
)

try:
    # Fetch a list of assets
    assets = client.market.get_assets()
    for asset in assets.data:
        print(f"Asset ID: {asset.id}, Symbol: {asset.symbol}, Name: {asset.name}")
except Exception as e:
    print(f"An error occurred: {e}")

Replace YOUR_API_KEY and YOUR_API_SECRET with your actual credentials. The market.get_assets() method directly interacts with the relevant API endpoint.

Using JavaScript SDK

First, install the Brave NewCoin JavaScript SDK:

npm install @bravenewcoin/bnc-sdk

Then, use the following JavaScript code:

const { BraveNewCoinClient } = require('@bravenewcoin/bnc-sdk');

// Initialize the client
const client = new BraveNewCoinClient({
  apiKey: 'YOUR_API_KEY',
  apiSecret: 'YOUR_API_SECRET',
});

async function getAssets() {
  try {
    const assets = await client.market.getAssets();
    assets.data.forEach(asset => {
      console.log(`Asset ID: ${asset.id}, Symbol: ${asset.symbol}, Name: ${asset.name}`);
    });
  } catch (error) {
    console.error('An error occurred:', error);
  }
}

getAssets();

Replace YOUR_API_KEY and YOUR_API_SECRET with your actual credentials. This asynchronous function demonstrates fetching assets using the getAssets method.

Common next steps

After successfully making your first API call, you can explore more advanced features and integrations:

  • Explore More Endpoints: The Brave NewCoin API documentation details various endpoints for historical data, real-time prices, indices, and more. Experiment with different data types relevant to your application, such as fetching specific market data for a cryptocurrency like Bitcoin.
  • Implement Advanced Authentication: For production environments, consider implementing more robust authentication mechanisms, such as request signing, if required by specific endpoints. This often involves using your API secret to generate a signature for each request, enhancing security.
  • Integrate with Your Application: Incorporate the retrieved data into your existing applications. This could involve displaying market trends on a dashboard, feeding data into an algorithmic trading system, or populating a digital asset portfolio tracker.
  • Monitor Rate Limits and Usage: Keep track of your API usage to ensure you stay within the limits of your subscription plan. The developer dashboard usually provides tools to monitor your request volume. Upgrade your plan if your application requires higher request volumes, as outlined on the Brave NewCoin pricing page.
  • Error Handling: Implement comprehensive error handling in your code to gracefully manage API errors, network issues, or unexpected data formats. This ensures your application remains stable and provides informative feedback to users.
  • Explore Webhooks: If real-time updates are critical, investigate whether Brave NewCoin offers webhook capabilities. Webhooks can push data to your application when specific events occur, reducing the need for constant polling, as described by Mozilla's webhook explanation.

Troubleshooting the first call

Encountering issues during your first API call is common. Here are some troubleshooting steps:

  • Check API Key and Secret: Double-check that your API key and secret are correctly entered and have not been truncated or altered. Typos are a frequent cause of authentication errors.
  • Verify Endpoint URL: Ensure the API endpoint URL is accurate according to the Brave NewCoin API reference. Incorrect URLs will result in 404 Not Found errors.
  • Review Authentication Headers: Confirm that the X-BNC-ApiKey header (or equivalent in SDKs) is correctly set. Missing or malformed authentication headers will typically lead to 401 Unauthorized errors.
  • Inspect Rate Limits: If you receive 429 Too Many Requests errors, you have likely exceeded your plan's rate limits. Wait for the reset period or consider upgrading your subscription. Details can be found on the Brave NewCoin pricing page.
  • Examine Error Messages: The API often returns descriptive error messages in the response body. Read these messages carefully, as they usually provide clues about the problem.
  • Network Connectivity: Ensure your development environment has stable internet connectivity and no firewall rules are blocking outgoing HTTP requests to api.bravenewcoin.com.
  • SDK Specific Issues: If using an SDK, ensure it is the latest version and that you are calling methods correctly as per the SDK's documentation. Consult the SDK-specific examples provided by Brave NewCoin.
  • Consult Documentation: The Brave NewCoin developer documentation is the authoritative source for API behavior, error codes, and troubleshooting guides.