> ## Documentation Index
> Fetch the complete documentation index at: https://docs.poix.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Find videos in specific location

> This guide demonstrates how to use the YouTube Data API to search for videos from a specific location, in this case, London.

## API Endpoint

```bash theme={null}
curl --request GET \
  --url 'https://api.poix.io/search?location=51.5074,0.1278&locationRadius=10km&type=video' \
  --header 'Authorization: Bearer <token>'
```

## Query Parameters

| Parameter      | Type   | Description                                   | Required |
| -------------- | ------ | --------------------------------------------- | -------- |
| location       | string | The location coordinates (latitude,longitude) | Yes      |
| locationRadius | string | The radius from the location to search within | Yes      |
| type           | string | The type of resource to search for            | Yes      |

## Example Usage

To search for videos from London, you can make the following API call:

```javascript index.ts theme={null}
const API_URL = 'https://api.poix.io';

const response = await fetch(
  API_URL + '/search?location=51.5074,0.1278&locationRadius=10km&type=video'
);

const data = await response.json();
```

## Response

The API will return a JSON object containing an array of video items. Each item includes:

* `videoId`: The unique identifier for the video
* `title`: The title of the video
* `description`: A brief description of the video
* `thumbnails`: Various thumbnail images for the video
* `channelTitle`: The title of the channel that uploaded the video

```json theme={null}
// Example response
{
    "regionCode": "US",
    "totalResults": 227525,
    "resultsPerPage": 50,
    "nextPageToken": "CDIQAA",
    "data": [
        {
            "kind": "youtube#video",
            "videoId": "EwDMEOwuj-w",
            "publishedAt": "2021-07-13T23:32:40Z",
            "channelId": "UCq0YzIwOg3zYLWqe4Nl-tog",
            "title": "The Way To Alagadda - A Song from the SCP Wiki",
           ...
```

For a complete list of returned fields, please refer to the [API documentation](/api-reference/search/get-search-results).

## Technical Details

* The `location` parameter uses the format `latitude,longitude`. For London, we use the coordinates `51.5074,0.1278`.
* The `locationRadius` parameter specifies the geographic area in which to search. It must be used in conjunction with the `location` parameter.
* The `type` parameter must be set to `video` when using location-based search.

## Error Handling

If the API call fails, it will return an appropriate HTTP status code along with an error message in the response body. Common errors include:

* 400 Bad Request: Invalid query parameters
* 403 Forbidden: Token is missing or invalid

Always handle potential errors in your code to ensure a smooth user experience.

## Note

Location-based search may not always return results exactly within the specified radius. The API uses the location and radius as a hint to return relevant results, but may include videos from a slightly larger area if necessary to provide a good set of results.
