# Try an API

The Developer Portal includes a built-in API testing feature that lets you send requests to API endpoints directly from your browser. This helps you explore and validate APIs before integrating them into your applications.

## Prerequisites[​](#prerequisites "Direct link to Prerequisites")

* A Developer Portal account with an active status.
* An [application](https://docs.api7.ai/api7-gateway/developer-portal/guides/create-application.md) subscribed to the API product you want to test.
* A valid [credential](https://docs.api7.ai/api7-gateway/developer-portal/guides/manage-credentials.md) that matches the API product's authentication type.

## Send a Test Request[​](#send-a-test-request "Direct link to Send a Test Request")

1. Log in to the Developer Portal.

2. Navigate to the **API Hub** and select the API product.

3. Browse to the endpoint you want to test.

4. Click **Try It Out** (or **Test Request**).

5. The authentication type is pre-selected based on your credentials. If the API product supports multiple authentication types, select the one that matches your credential.

6. Your credential is automatically populated (for example, the API key or basic auth credentials).

7. Configure the request parameters:

   | Parameter            | Description                                               |
   | -------------------- | --------------------------------------------------------- |
   | **Path parameters**  | Fill in required URL path segments.                       |
   | **Query parameters** | Add query string parameters.                              |
   | **Headers**          | Add or modify request headers.                            |
   | **Request body**     | Enter the request body for POST, PUT, and PATCH requests. |

8. Click **Send**.

## Review the Response[​](#review-the-response "Direct link to Review the Response")

After sending a request, the portal displays:

* **Status code**: The HTTP response status (for example, 200, 401, 404).
* **Response headers**: The HTTP headers returned by the server.
* **Response body**: The response payload, formatted for readability.

## Troubleshooting[​](#troubleshooting "Direct link to Troubleshooting")

### CORS Errors[​](#cors-errors "Direct link to CORS Errors")

When testing APIs from the browser, you may encounter CORS (Cross-Origin Resource Sharing) errors. This happens because browsers enforce CORS restrictions and send a preflight `OPTIONS` request. If the gateway route does not allow the `OPTIONS` method or the CORS plugin is not enabled, the browser blocks the request.

To resolve CORS errors:

* Ask the API provider to enable the [`cors`](https://docs.api7.ai/hub/cors.md) plugin on the relevant routes or globally.
* When the CORS plugin is configured globally, preflight `OPTIONS` requests are handled automatically.

### Authentication Errors[​](#authentication-errors "Direct link to Authentication Errors")

If you receive a `401 Unauthorized` response:

1. Verify that your subscription is active (not pending approval).
2. Verify that your credential type matches the API product's authentication type.
3. If using OAuth, verify that your access token is not expired.
4. If using key authentication, verify that the API key is correct and has not been regenerated.

### Endpoint Not Found[​](#endpoint-not-found "Direct link to Endpoint Not Found")

If you receive a `404 Not Found` response:

1. Verify that the endpoint path matches the API documentation.
2. Verify that the `Host` header matches one of the hosts configured on the linked service.
3. Check that the HTTP method matches the endpoint specification.

## Additional Resources[​](#additional-resources "Direct link to Additional Resources")

* [Browse APIs](https://docs.api7.ai/api7-gateway/developer-portal/guides/browse-apis.md)
* [Manage Credentials](https://docs.api7.ai/api7-gateway/developer-portal/guides/manage-credentials.md)
