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

# Get Timezone by City

> Retrieve the timezone for a specific city

Get the timezone for a specific city. The country and state codes in the path are not redundant — they're enforced server-side as an **ownership check**: a city ID is only resolved if it actually belongs to the given state inside the given country.

This prevents "city-ID spoofing" — a caller can't learn the timezone of an arbitrary city by trying its ID under a different country/state pair.

> [!NOTE]
>
> **Availability:** All plans (Community and above). Only an API key is required.

> [!NOTE]
>
> Responses are cached server-side for 24 hours. The cache key includes country, state, **and** city ID, so the ownership check holds on cache HIT — a city ID looked up under one (ciso, siso) pair won't satisfy a request under a different pair.

## Response

Same shape as the country and state timezone endpoints:

```bash cURL (San Francisco, CA) theme={null}
curl -X GET 'https://api.countrystatecity.in/v1/timezone/US/CA/24295' \
  -H 'X-CSCAPI-KEY: YOUR_API_KEY'
```

```bash cURL (Mumbai, IN-MH) theme={null}
curl -X GET 'https://api.countrystatecity.in/v1/timezone/IN/MH/57614' \
  -H 'X-CSCAPI-KEY: YOUR_API_KEY'
```

```javascript JavaScript theme={null}
const response = await fetch(
  'https://api.countrystatecity.in/v1/timezone/US/CA/24295',  // San Francisco
  { headers: { 'X-CSCAPI-KEY': 'YOUR_API_KEY' } }
);

const tz = await response.json();
const localNow = new Date().toLocaleString('en-US', { timeZone: tz.iana });
console.log(`Current local time: ${localNow}`);
```

```python Python theme={null}
import requests

response = requests.get(
  'https://api.countrystatecity.in/v1/timezone/US/NY/124394',  # New York City
  headers={'X-CSCAPI-KEY': 'YOUR_API_KEY'}
)

print(response.json()['iana'])  # "America/New_York"
```

```json 200 - San Francisco (DST in summer) theme={null}
{
  "iana": "America/Los_Angeles",
  "abbreviation": "PDT",
  "offset_utc": "-08:00",
  "dst_offset_utc": "-07:00",
  "is_dst_now": true
}
```

```json 404 - City not in this country/state theme={null}
{
  "error": "City not found."
}
```

```json 404 - No timezone on record theme={null}
{
  "error": "No timezone data available for this city."
}
```

## Related Endpoints

* [Get Timezone by Country](https://docs.countrystatecity.in/api/endpoints/get-timezone-by-country.md) — country-level (uses the capital's timezone)
* [Get Timezone by State](https://docs.countrystatecity.in/api/endpoints/get-timezone-by-state.md) — state-level precision
* [Get Cities by State](https://docs.countrystatecity.in/api/endpoints/get-cities-by-state.md) — list cities to find the right city ID

## Notes on `city_id`

The `city_id` is the same numeric ID returned by all list endpoints (`/v1/countries/:ciso/states/:siso/cities`, `/v1/cities`, etc.). If you stored a city ID in your own database, this endpoint is the canonical way to look up its timezone without re-fetching the full city record.


## OpenAPI

````yaml GET /timezone/{ciso}/{siso}/{city_id}
openapi: 3.0.3
info:
  title: Country State City API
  description: >-
    Geographic data API providing countries, states, cities, timezones,
    currencies, and phone dial codes with tiered access levels.


    ## Authentication

    All endpoints require an API key passed via the `X-CSCAPI-KEY` header. Get
    your free key at [app.countrystatecity.in](https://app.countrystatecity.in).


    ## Pricing & Limits

    The fields returned, endpoints available, and request quotas depend on your
    plan. See current tiers and limits at:


    **[countrystatecity.in/pricing](https://countrystatecity.in/pricing)**


    ## Data Access Levels

    Each plan includes a data access level that controls which fields are
    returned:


    - **Basic** — Core fields: id, name, iso2, iso3, phonecode, capital,
    currency, coordinates, region, timezones, emoji

    - **Coordinates** — Basic + extended metadata (population, tld, nationality,
    currency details, postal codes, etc.)

    - **Full** — All fields including translations (18+ languages) and
    wikiDataId


    Fields restricted to higher tiers are marked in each schema below.


    ## Feature Gating

    Some endpoints require a minimum tier. Restricted endpoints return `403`
    with an `upgradeUrl` when accessed on a lower plan. Check the [pricing
    page](https://countrystatecity.in/pricing) for current feature availability.


    ## Rate Limiting

    Requests exceeding your daily or monthly quota receive a `429` response with
    your current limit, period, tier, and an upgrade URL.


    ## Caching

    Cacheable geographic responses include `Cache-Control`, `ETag`, and
    `X-Cache` (HIT/MISS) headers; send `If-None-Match` on them to receive `304
    Not Modified`. Phone number parsing is never cached (`Cache-Control:
    no-store`, no `ETag`); see each endpoint for exceptions.


    ## Usage Headers

    All `/v1/*` responses include usage and plan headers:

    - `X-CSC-Plan` — your current tier

    - `X-CSC-Daily-Used` / `X-CSC-Daily-Limit` — today's usage vs limit

    - `X-CSC-Monthly-Used` / `X-CSC-Monthly-Limit` — this month's usage vs limit


    Use these to monitor consumption without a separate API call.
  contact:
    name: Darshan Gada (dr5hn)
    email: gadadarshan@gmail.com
    url: https://countrystatecity.in
  license:
    name: Creative Commons Attribution 4.0
    url: https://creativecommons.org/licenses/by/4.0/
  version: 2.4.1
servers:
  - url: https://api.countrystatecity.in/v1
    description: Production API
security: []
tags:
  - name: Countries
    description: Country data — 250+ countries with metadata, coordinates, and translations
  - name: States
    description: State/province/region data — 5,000+ subdivisions
  - name: Cities
    description: City data — 150,000+ cities worldwide
  - name: Postcodes
    description: >-
      Postcode and ZIP code lookup and search. Informational data, not address
      verification.
  - name: Regions
    description: Geographic regions and subregions — continental groupings of countries
  - name: Timezones
    description: >-
      IANA timezone lookup by country, state, or city — includes UTC offset and
      DST status
  - name: Currencies
    description: ISO 4217 currency data — list all currencies or look up by country
  - name: Phone
    description: >-
      International dial codes — list, lookup by country, and E.164 phone number
      parsing
  - name: ISO
    description: >-
      ISO 3166 code lookup and conversion — country (alpha-2/3/numeric) and
      state (ISO 3166-2)
  - name: Search
    description: Typo-tolerant fuzzy search across cities, states, and countries
  - name: Changes
    description: >-
      Data change feed — track additions, removals, and updates to place records
      over time. **Professional and Business plans only.**
  - name: Meta
    description: Information about the dataset release currently served
paths:
  /timezone/{ciso}/{siso}/{city_id}:
    get:
      tags:
        - Timezones
      summary: Get timezone by city
      description: >-
        Returns the canonical IANA timezone for a specific city. The city ID is
        validated against the given country and state to prevent
        cross-jurisdiction lookups.


        **Availability:** All plans (Community and above). Responses cached
        server-side for 24 hours.
      operationId: getTimezoneByCity
      parameters:
        - name: ciso
          in: path
          description: ISO 3166-1 alpha-2 (e.g., `US`), alpha-3, or numeric country ID
          required: true
          schema:
            type: string
            example: US
        - name: siso
          in: path
          description: State/province code (e.g., `CA`)
          required: true
          schema:
            type: string
            example: CA
        - name: city_id
          in: path
          description: Numeric city ID (from the cities endpoints)
          required: true
          schema:
            type: integer
            example: 24295
      responses:
        '200':
          description: Timezone information for the city
          headers:
            Cache-Control:
              $ref: '#/components/headers/CacheControl'
            ETag:
              $ref: '#/components/headers/ETag'
            X-Cache:
              $ref: '#/components/headers/XCache'
            X-CSC-Plan:
              $ref: '#/components/headers/XCSCPlan'
            X-CSC-Daily-Used:
              $ref: '#/components/headers/XCSCDailyUsed'
            X-CSC-Daily-Limit:
              $ref: '#/components/headers/XCSCDailyLimit'
            X-CSC-Monthly-Used:
              $ref: '#/components/headers/XCSCMonthlyUsed'
            X-CSC-Monthly-Limit:
              $ref: '#/components/headers/XCSCMonthlyLimit'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TimezoneInfo'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          description: City not found, or no timezone data for it
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StatusError'
              example:
                status: error
                message: City not found.
        '429':
          $ref: '#/components/responses/RateLimited'
      security:
        - ApiKeyAuth: []
components:
  headers:
    CacheControl:
      description: Cache directive
      schema:
        type: string
        example: public, max-age=3600
    ETag:
      description: Entity tag for conditional requests (use with `If-None-Match`)
      schema:
        type: string
        example: '"a3f2b8c1d4e5f6a7b8c9d0e1f2a3b4c5"'
    XCache:
      description: Whether the response was served from cache
      schema:
        type: string
        enum:
          - HIT
          - MISS
        example: HIT
    XCSCPlan:
      description: Your current pricing tier
      schema:
        type: string
        enum:
          - community
          - starter
          - supporter
          - professional
          - business
          - legacy
          - custom
        example: supporter
    XCSCDailyUsed:
      description: Number of requests used today
      schema:
        type: integer
        example: 42
    XCSCDailyLimit:
      description: Your daily request limit (or 'unlimited' for custom plans)
      schema:
        type: string
        example: '1000'
    XCSCMonthlyUsed:
      description: Number of requests used this month
      schema:
        type: integer
        example: 850
    XCSCMonthlyLimit:
      description: Your monthly request limit (or 'unlimited' for custom plans)
      schema:
        type: string
        example: '30000'
  schemas:
    TimezoneInfo:
      type: object
      description: >-
        IANA timezone with current UTC offset and DST status. Standard and DST
        offsets are sampled from Jan 1 and Jul 1 of the current year.
      properties:
        iana:
          type: string
          description: Canonical IANA timezone identifier
          example: Asia/Kolkata
        abbreviation:
          type: string
          description: Locale-aware short code (display only — not unique across timezones)
          example: IST
        offset_utc:
          type: string
          description: Standard UTC offset in ±HH:MM format
          example: '+05:30'
        dst_offset_utc:
          type: string
          description: >-
            DST UTC offset in ±HH:MM format; equals `offset_utc` for zones
            without DST
          example: '+05:30'
        is_dst_now:
          type: boolean
          description: Whether DST is currently active
          example: false
      required:
        - iana
        - abbreviation
        - offset_utc
        - dst_offset_utc
        - is_dst_now
    StatusError:
      type: object
      description: Error envelope used by the postcode and meta endpoints.
      properties:
        status:
          type: string
          example: error
        message:
          type: string
        details:
          type: object
          nullable: true
          properties:
            reason:
              type: string
              description: >-
                Machine-readable reason. Check this instead of parsing
                `message`.
          additionalProperties: true
      required:
        - status
        - message
    Error:
      type: object
      properties:
        error:
          type: string
          description: Error message
      required:
        - error
    RateLimitError:
      type: object
      properties:
        error:
          type: string
          example: >-
            Daily usage limit exceeded. Please try again tomorrow or contact
            support for higher limits.
        limit:
          type: integer
          description: Your plan's limit for the exceeded period
          example: 100
        period:
          type: string
          enum:
            - daily
            - monthly
          example: daily
        tier:
          type: string
          description: Your current tier
          example: community
        upgradeUrl:
          type: string
          description: URL to upgrade your plan
          example: https://countrystatecity.in/pricing
      required:
        - error
  responses:
    Unauthorized:
      description: Missing or invalid API key
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: Unauthorized. You shouldn't be here.
    RateLimited:
      description: Daily or monthly usage limit exceeded
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/RateLimitError'
          example:
            error: >-
              Daily usage limit exceeded. Please try again tomorrow or contact
              support for higher limits.
            limit: 100
            period: daily
            tier: community
            upgradeUrl: https://countrystatecity.in/pricing
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      description: >-
        API key for authentication. Get your free key at
        [app.countrystatecity.in](https://app.countrystatecity.in).
      name: X-CSCAPI-KEY
      in: header

````

## Related topics

- [Get Timezone by State](https://docs.countrystatecity.in/api/endpoints/get-timezone-by-state.md)
- [Get Timezone by Country](https://docs.countrystatecity.in/api/endpoints/get-timezone-by-country.md)
- [Get Cities by Country](https://docs.countrystatecity.in/api/endpoints/get-cities-by-country.md)
- [Get Cities by State](https://docs.countrystatecity.in/api/endpoints/get-cities-by-state.md)
- [Frequently Asked Questions](https://docs.countrystatecity.in/api/faq.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.