Getting started overview

Integrating the Yelp Fusion API into an application involves a sequence of steps designed to ensure secure and authorized access to business data. Developers will typically register on the Yelp developer portal, create an application to generate necessary credentials, and then implement an OAuth 2.0 authentication flow to obtain an access token. This token is subsequently used in API requests to retrieve information such as business listings, details, and user review snippets. The process prioritizes secure credential management and adherence to rate limits.

The Yelp Fusion API is primarily focused on providing business search and detail capabilities. Access to full review content is restricted and typically requires explicit permission beyond standard API access Yelp Fusion API documentation. The standard free tier allows up to 5,000 requests per day, with custom enterprise pricing available for higher volumes Yelp API terms.

This guide provides a structured approach to initiate development with the Yelp Fusion API:

  1. Account Creation: Registering for a Yelp developer account.
  2. Application Setup: Creating a new application to obtain API keys.
  3. Authentication: Understanding and implementing OAuth 2.0 for API requests.
  4. First Request: Executing a basic API call to retrieve business data.
  5. Next Steps: Exploring further API capabilities and best practices.

Create an account and get keys

To access the Yelp Fusion API, developers must first register for a developer account and create an application. This process generates the necessary API credentials.

Step 1: Register for a developer account

  1. Navigate to the Yelp for Developers website.
  2. Click on the 'Get Started' or 'Sign Up' button.
  3. Follow the prompts to create a new account or log in if you already have one. This typically involves providing an email address, setting a password, and agreeing to the terms of service.

Step 2: Create a new application

Once logged in, you will need to create an application to obtain your API keys (Client ID and Client Secret).

  1. From your developer account dashboard, locate and click on 'Create New App' or a similar option.
  2. Application Name: Provide a descriptive name for your application (e.g., "My Business Finder App").
  3. Contact Email: Enter a valid contact email.
  4. Industry: Select the industry that best describes your application.
  5. Description: Briefly describe your application's purpose and how it will use the Yelp API.
  6. Callback URL: For server-side applications, this is often not strictly required for the Fusion API's client credentials flow, but it's good practice to provide a placeholder or your application's base URL if one exists. For front-end applications, this might be relevant if you later implement a user-authorization flow.
  7. Review and accept the Yelp API Terms of Use.
  8. Click 'Create New App'.

Step 3: Retrieve your API Keys

Upon successful application creation, you will be directed to your application's details page. Here, you will find your:

  • Client ID: A public identifier for your application.
  • Client Secret: A confidential key used to authenticate your application. Treat this as sensitive information and protect it from unauthorized access.

These credentials (Client ID and Client Secret) are crucial for obtaining an OAuth 2.0 access token, which is then used to authorize your API requests. The Yelp Fusion API utilizes the OAuth 2.0 Client Credentials Grant flow for application-level authentication.

Your first request

Making your first request to the Yelp Fusion API involves two primary steps: obtaining an access token and then using that token to call an API endpoint. This example will focus on using the /businesses/search endpoint to find businesses.

Step 1: Obtain an OAuth 2.0 Access Token

The Yelp Fusion API requires an OAuth 2.0 access token for all authenticated requests. You obtain this token by sending a POST request to Yelp's token endpoint using your Client ID and Client Secret.

Example using curl:

curl -X POST "https://api.yelp.com/oauth2/token" \
     -H "Content-Type: application/x-www-form-urlencoded" \
     -d "grant_type=client_credentials&client_id=YOUR_CLIENT_ID&client_secret=YOUR_CLIENT_SECRET"

Replace YOUR_CLIENT_ID and YOUR_CLIENT_SECRET with the actual values from your Yelp application. The response will be a JSON object containing your access_token and its expires_in duration (typically 180 days).

Expected Token Response:

{
  "access_token": "YOUR_ACCESS_TOKEN",
  "token_type": "Bearer",
  "expires_in": 15552000
}

Store the access_token, as it will be used in subsequent API calls. Access tokens have a long validity period (180 days), reducing the frequency with which you need to re-request them Yelp authentication guide.

Step 2: Make a Business Search Request

With your access_token, you can now make calls to the Yelp Fusion API. The /businesses/search endpoint is a common starting point, allowing you to search for businesses based on various criteria like location, term, and categories.

Example using curl to search for "coffee" in "San Francisco":

curl -X GET "https://api.yelp.com/v3/businesses/search?term=coffee&location=san%20francisco" \
     -H "Authorization: Bearer YOUR_ACCESS_TOKEN"

Replace YOUR_ACCESS_TOKEN with the token obtained in the previous step. The Authorization header is critical for authenticating your request.

Expected Business Search Response (truncated for brevity):

{
  "businesses": [
    {
      "id": "some-business-id",
      "name": "Philz Coffee",
      "image_url": "...",
      "is_closed": false,
      "url": "...",
      "review_count": 5000,
      "categories": [{"alias": "coffee", "title": "Coffee & Tea"}],
      "rating": 4.5,
      "coordinates": {"latitude": 37.779379, "longitude": -122.394236},
      "location": {"address1": "201 Berry St", "city": "San Francisco", ...},
      "phone": "+14152480300",
      "display_phone": "+1 415-248-0300",
      "distance": 1604.234
    }
    // ... more businesses
  ],
  "total": 1000,
  "region": {
    "center": {
      "longitude": -122.394236,
      "latitude": 37.779379
    }
  }
}

Quick Reference: Getting Started Steps

Step What to Do Where
1. Sign Up Create a Yelp developer account. Yelp for Developers
2. Create App Register a new application to get Client ID & Secret. Yelp Developer Dashboard
3. Get Token POST to /oauth2/token with Client ID/Secret. https://api.yelp.com/oauth2/token
4. Make Request GET to a Fusion API endpoint with Authorization: Bearer YOUR_ACCESS_TOKEN. e.g., https://api.yelp.com/v3/businesses/search

Common next steps

After successfully making your first request, several common next steps can enhance your integration with the Yelp Fusion API:

  • Explore More Endpoints: The Yelp Fusion API offers various endpoints beyond basic search, including business search by phone, fetching business details by ID, and transaction search. Consult the comprehensive Yelp Fusion API reference for a full list and their parameters.
  • Implement Error Handling: Incorporate robust error handling into your application to manage API rate limits, invalid requests, and other potential issues. The API returns standard HTTP status codes and JSON error bodies.
  • Manage Rate Limits: Be mindful of the rate limits (5,000 requests per day for the free tier). Implement caching strategies or request throttling to stay within these limits Yelp rate limiting documentation.
  • Utilize Location Features: Experiment with location-based parameters for more precise searches, such as latitude/longitude and radius, which can be useful for mapping applications or proximity searches.
  • Integrate with SDKs: While Yelp does not officially provide SDKs, community-maintained libraries exist for popular languages like Python, Node.js, and Ruby. These can simplify API interaction by abstracting HTTP requests and authentication Yelp API developer resources. However, always verify the maintenance and security of third-party libraries.
  • Review API Terms: Regularly review the Yelp API Terms of Use to ensure ongoing compliance, especially regarding data display, attribution, and review content usage policies.
  • Consider Enterprise Access: For high-volume applications or specific needs like full review content access, explore the possibility of Yelp's enterprise solutions, which offer higher rate limits and specialized access.

Troubleshooting the first call

If your first API call to Yelp encounters issues, here are common problems and their solutions:

400 Bad Request

  • Cause: Incorrect parameters in the request, such as missing required fields or malformed data.
  • Solution: Double-check your request URL and body against the Yelp Fusion API documentation for the specific endpoint you are calling. Ensure all required parameters (e.g., term and location for search) are present and correctly formatted.

401 Unauthorized

  • Cause 1: Missing or invalid Authorization header in your API request.
  • Solution 1: Ensure your Authorization: Bearer YOUR_ACCESS_TOKEN header is correctly formatted and that YOUR_ACCESS_TOKEN is the valid token obtained from the /oauth2/token endpoint.
  • Cause 2: Expired access token.
  • Solution 2: Although Yelp access tokens have a long lifespan (180 days), they do expire. If your token is old, request a new one using your Client ID and Client Secret.
  • Cause 3: Incorrect Client ID or Client Secret during token generation.
  • Solution 3: Verify that the Client ID and Client Secret used in the /oauth2/token request exactly match the credentials from your Yelp developer application Yelp API authentication errors.

403 Forbidden

  • Cause: Your application does not have permission to access the requested resource. This can happen if you're trying to access a restricted API (like full review content without special permission) or if your account has been flagged.
  • Solution: Verify that the endpoint you are calling is part of the standard Yelp Fusion API access. If you require access to restricted data, you may need to contact Yelp's developer support.

429 Too Many Requests

  • Cause: You have exceeded the API's rate limit (e.g., 5,000 requests per day for the free tier).
  • Solution: Implement client-side rate limiting, caching of API responses, or retry mechanisms with exponential backoff. If consistently hitting limits, consider upgrading to an enterprise plan.

Network Issues or DNS Resolution Failures

  • Cause: Problems with your internet connection or inability to resolve api.yelp.com.
  • Solution: Check your network connectivity. If running in a restricted environment, ensure that outbound connections to api.yelp.com and api.yelp.com/oauth2/token are not blocked by firewalls or proxies.