This page has troubleshooting procedures for the following problems that people may encounter with the Looker API:
- API endpoint isn’t reachable
- API calls hang
- Login attempts return 404 errors
- Invalid encoding errors
API Endpoint Isn’t Reachable
If you can’t reach an API endpoint, you can verify:
Verify Your API Credentials
If your Looker API endpoint isn’t reachable, the first step is to verify that your API credentials are correct:
- In Looker, click on Admin at the top right of the window.
- In the left panel of the Admin page, scroll down and click API.
- On the API page, click the View API Docs link to open the interactive API Explorer. (See this documentation page for information on the interactive API Explorer.) If the API Explorer does not open, you may need to verify the API port.
- In the API Explorer, enter the API3 client ID and client secret. (See this documentation page for information on setting up API3 keys.)
- Click Log In.
- Scroll down to the User : Manage Users section and click the arrow to expand it.
- Click on the
me()API call to expand it.
- Click the Try it out! button.
This should produce a
200 Response Code with a Response body that starts with something like this:
In the API Explorer, it looks something like this:
If you see the expected
json output, then your API credentials are working. Try to use these exact credentials to reach your API endpoint. If you still cannot reach the API endpoint using these credentials, next verify that you’re using the correct API URL.
Verify the API URL
Another common problem in reaching an API endpoint is an incorrect API host URL. Most Looker instances use the default URL for the API. However, Looker installations located behind a load balancer (for example, a cluster configuration) or any other proxy might not use the default URL. In which case, the API host URL must indicate the user-facing API host name and port.
Looker admins can see the API host URL in the API admin settings (described on this documentation page):
If the API Host URL field is blank, your Looker instance uses the default format, which is:
You can test the API host URL by doing the following:
- Open a browser and open the browser console. (This link might be helpful if you need to know how to open a console for your browser.)
- Enter your API host URL in this format:
If the API host URL is correct, this URL will result in a blank web page, and not an error page:
You can also verify that you’ve reached the API by looking at the network response in the browser console. The network response should be
If these checks fail, the problem may be that you are calling the API incorrectly or that you have other errors in your code. Check your API calls and the code in your script. If those are correct, see the next section about verifying your port.
Verify the API Port
If the above checks fail and you have an on-premise Looker instance, it is possible that the API port needs to be opened on the network infrastructure.
The API port should forward to the Looker server. For on-premise Looker instances, ask your network administrator to check the API port settings. The API port (port
19999 by default) should have the same configuration settings as the Looker instance port (port
9999 by default). Your network administrator should verify that the following settings are the same for the API port as they are for your Looker instance port:
- Load balancers
API Calls Hang
If you are able to open the API Explorer, but your API calls hang, verify that your Looker instance’s API Host URL setting is either blank or set correctly. Looker admins can see the API host URL in Looker’s API admin settings (described on this documentation page):
Login Attempts Return 404 Errors
If API login attempts are returning
404 errors, it’s most likely because your API3 client ID or client secret isn’t valid. The API login REST endpoint is one of the following, depending on the API version in use:
If using a Swagger codegen API or a Looker SDK, ensure your
base_url value is correct:
- For a Swagger codegen client, the
base_urlshould be one of the following, depending on the API version in use:
For Looker SDK implementations that use a
looker.ini, the values should be:
# api_version should be either 3.0 or 3.1 api_version=3.0 base_url=https://<your-looker-hostname>:19999
Invalid Encoding Errors
If you receive an encoding error when attempting to make an API call, you may need to set the proper
Content-Type in your header during the request. HTTP protocol standards require that any POST, PUT, or PATCH request contain a
Content-Type header. Since the Looker API uses JSON throughout, the
Content-Type header should be set to
Note that using a Looker SDK will automatically deal with this concern for you.