# Place details

The full record of one place.

Returns the full record of one place found by a `places` search: address parts, coordinates, categories, contact details, opening hours and time zone. Ask for fewer `fields` when you need less.

### What is charged

Charged when the place comes back. An unknown or expired `place_id` returns `404 not_found` and is free.

Units: `place_details`, `place_details_rich`. `usage.items` in the response lists them.

## Request

```
POST https://api.websearch.fast/v1/web/places/details
```

Planned. Until it ships, calls return `501 api_not_implemented`.

### Body

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `place_id` | string | yes | At most 128 characters. Starts with `pl_`. |
| `language` | string |  | BCP 47 language tag. At most 12 characters. |
| `fields` | array of string |  | One of `basic`, `contact`, `hours`, `rating`, `attributes`, `photos`. |

### Example request

curl:

```bash
curl https://api.websearch.fast/v1/web/places/details \
  -H "Authorization: Bearer $WEBSEARCH_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "place_id": "pl_8Fq2kLm0",
    "fields": ["basic", "contact", "hours"]
  }'
```

Python:

```python
import os
import httpx

response = httpx.post(
    "https://api.websearch.fast/v1/web/places/details",
    headers={"Authorization": f"Bearer {os.environ['WEBSEARCH_API_KEY']}"},
    json={
        "place_id": "pl_8Fq2kLm0",
        "fields": ["basic", "contact", "hours"],
    },
    timeout=60,
)
response.raise_for_status()
print(response.json())
```

TypeScript:

```typescript
const response = await fetch("https://api.websearch.fast/v1/web/places/details", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.WEBSEARCH_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    place_id: "pl_8Fq2kLm0",
    fields: ["basic", "contact", "hours"],
  }),
});
if (!response.ok) throw new Error(`HTTP ${response.status}`);
console.log(await response.json());
```

### Example response

```json
{
  "object": "web.place",
  "request_id": "20261128120003123456789a1b2c3d4Kx7Qm2Pd",
  "created": 1795867203,
  "input": {"place_id": "pl_8Fq2kLm0", "language": "en"},
  "place": {
    "place_id": "pl_8Fq2kLm0",
    "title": "Corner Bakery",
    "address": "12 Market St, Springfield",
    "location": {"lat": 40.7128, "lon": -74.006},
    "categories": ["bakery", "cafe"],
    "phone": "+12125550100",
    "website": "https://cornerbakery.example.com",
    "timezone": "America/New_York",
    "opening_hours": {
      "open_now": true,
      "weekly": [{"day": 1, "open": "07:00", "close": "18:00"}]
    },
    "origin": "open_data",
    "updated_at": 1795800000
  },
  "usage": {
    "charged": true,
    "items": [{"unit": "place_details", "count": 1}]
  }
}
```

### Response fields

The place.

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `object` | string | yes | Always `web.place`. |
| `request_id` | string | yes | Same as the X-Request-Id header. |
| `created` | integer | yes | Unix seconds (UTC). |
| `input` | object | yes | The parameters as applied, defaults filled in. |
| `usage` | object | yes |  |
| `usage.charged` | boolean | yes |  |
| `usage.items` | array of object | yes |  |
| `usage.items.unit` | string | yes | Billable unit, for example search_web, content_page, fetch_page, geocode, autocomplete, knowledge. |
| `usage.items.count` | integer | yes |  |
| `cache` | object |  |  |
| `cache.hit` | boolean | yes | The response, or every page in it, came from a stored copy. |
| `cache.data_age_seconds` | integer | yes | Age of the oldest part of the response. |
| `cache.fetched_at` | integer | yes | Unix seconds when the oldest part was read. |
| `warnings` | array of object |  |  |
| `warnings.code` | string | yes | For example no_results, content_partial, answer_unavailable, partial, all_failed, reach_reduced. |
| `warnings.message` | string |  |  |
| `warnings.param` | string |  |  |
| `place` | object | yes |  |
| `place.position` | integer | yes | At least 1. |
| `place.title` | string | yes |  |
| `place.origin` | string | yes | Our neutral label of how the result reached you. New values can appear. One of `index`, `live`, `open_data`. |
| `place.place_id` | string | yes | Our opaque id, pl_... Starts with `pl_`. |
| `place.url` | string |  | The place's own website, when known; never a map service page. |
| `place.domain` | string |  |  |
| `place.snippet` | string |  |  |
| `place.address` | string |  |  |
| `place.location` | object | yes |  |
| `place.location.lat` | number | yes | -90 to 90. |
| `place.location.lon` | number | yes | -180 to 180. |
| `place.categories` | array of string |  |  |
| `place.rating` | number |  | 0 to 5. |
| `place.rating_count` | integer |  |  |
| `place.price_level` | integer |  | 1 to 4. |
| `place.phone` | string |  |  |
| `place.website` | string |  |  |
| `place.opening_hours` | object |  |  |
| `place.opening_hours.open_now` | boolean |  |  |
| `place.opening_hours.text` | array of string |  |  |
| `place.opening_hours.weekly` | array of object |  |  |
| `place.description` | string |  |  |
| `place.thumbnail_url` | string |  |  |
| `place.distance_m` | number |  |  |
| `place.address_components` | object |  |  |
| `place.address_components.house_number` | string |  |  |
| `place.address_components.street` | string |  |  |
| `place.address_components.district` | string |  |  |
| `place.address_components.city` | string |  |  |
| `place.address_components.region` | string |  |  |
| `place.address_components.postal_code` | string |  |  |
| `place.address_components.country` | string |  |  |
| `place.address_components.country_code` | string |  |  |
| `place.timezone` | string |  | IANA time zone. |
| `place.attributes` | object |  |  |
| `place.photos` | array of object |  |  |
| `place.photos.url` | string | yes |  |
| `place.photos.width` | integer |  |  |
| `place.photos.height` | integer |  |  |
| `place.updated_at` | integer |  |  |

### Errors

| Status | Codes |
| --- | --- |
| `400` | `invalid_request`, `invalid_url`, `invalid_schema` or `invalid_image`. Not charged. |
| `401` | `invalid_token`. Not charged. |
| `403` | `pre_consume_token_quota_failed` (the key's own spending limit), `access_denied`, `web_not_allowed` or `model_not_in_plan` (customer keys while plans cannot include the web tools). Not charged. |
| `404` | `not_found` or `invalid_endpoint`. Not charged. |
| `413` | `read_request_body_failed`: the request body is over the limit. Not charged. |
| `429` | `rate_limited`, `concurrency_limited`, `api_key_temporarily_frozen`, or the failure guard. Not charged. |
| `500` | `internal_error`. Not charged. |
| `501` | `api_not_implemented`: the endpoint, type or option has not shipped. Not charged. |
| `503` | `source_unavailable`, `web_api_disabled`, `token_cache_busy` or `billing_busy` (the charge could not be prepared in time; retry after Retry-After). Not charged. |
| `504` | timeout. Not charged. |
