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

# Convert IP

> This http method allows you to convert a single IP address into its corresponding geolocation data.



## OpenAPI

````yaml GET /convert
openapi: 3.0.3
info:
  title: Ip2Geo Convert IP API
  version: 1.0.0
  description: Lookup single IP address and get geolocation data.
servers:
  - url: https://api.ip2geo.dev
    description: Production Server
security: []
paths:
  /convert:
    get:
      summary: Ip2Geo - Convert IP
      parameters:
        - name: ip
          in: query
          description: IPv4 or IPv6 address to lookup.
          required: true
          schema:
            type: string
            format: ipv4
      responses:
        '200':
          description: Successful geolocation lookup.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SingleConvertResponse'
        '400':
          description: Bad request!
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Unauthorized!
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: Internal server error!
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - ApiKeyAuth: []
components:
  schemas:
    SingleConvertResponse:
      type: object
      properties:
        success:
          type: boolean
          description: Whether the request was successful.
        message:
          type: string
          description: Response message.
        code:
          type: integer
          description: HTTP status code.
        data:
          $ref: '#/components/schemas/Ip'
        _req:
          $ref: '#/components/schemas/RequestMeta'
      required:
        - success
        - message
        - code
        - _req
    ErrorResponse:
      type: object
      properties:
        success:
          type: boolean
          example: false
        message:
          type: string
          description: Error message.
        code:
          type: integer
          description: HTTP status code.
        data:
          type: object
          nullable: true
          description: Always null for error responses.
          example: null
        _req:
          $ref: '#/components/schemas/RequestMeta'
      required:
        - success
        - message
        - code
        - _req
    Ip:
      type: object
      properties:
        ip:
          type: string
          nullable: true
          description: The IP address.
        type:
          type: string
          enum:
            - ipv4
            - ipv6
          nullable: true
          description: IP address type.
        is_eu:
          type: boolean
          nullable: true
          description: Whether the IP is located in the European Union.
        continent:
          type: object
          nullable: true
          properties:
            name:
              type: string
              nullable: true
            code:
              type: string
              nullable: true
            geoname_id:
              type: integer
              nullable: true
              description: GeoNames ID for the continent.
            country:
              type: object
              nullable: true
              properties:
                name:
                  type: string
                  nullable: true
                code:
                  type: string
                  nullable: true
                geoname_id:
                  type: integer
                  nullable: true
                  description: GeoNames ID for the country.
                phone_code:
                  type: string
                  nullable: true
                capital:
                  type: string
                  nullable: true
                tld:
                  type: string
                  nullable: true
                subdivision:
                  type: object
                  nullable: true
                  description: State, province, or region information.
                  properties:
                    name:
                      type: string
                      nullable: true
                      description: Name of the state/province/region.
                    code:
                      type: string
                      nullable: true
                      description: >-
                        ISO code for the subdivision (e.g., 'CA' for
                        California).
                city:
                  type: object
                  nullable: true
                  properties:
                    name:
                      type: string
                      nullable: true
                    geoname_id:
                      type: integer
                      nullable: true
                      description: GeoNames ID for the city.
                    latitude:
                      type: number
                      nullable: true
                    longitude:
                      type: number
                      nullable: true
                    accuracy_radius:
                      type: integer
                      nullable: true
                      description: >-
                        Radius in kilometers around the coordinates where the IP
                        is likely located.
                    metro_code:
                      type: integer
                      nullable: true
                      description: Metro area code (US only).
                    postal_code:
                      type: string
                      nullable: true
                    timezone:
                      type: object
                      nullable: true
                      properties:
                        name:
                          type: string
                          nullable: true
                        time_now:
                          type: string
                          nullable: true
                flag:
                  type: object
                  nullable: true
                  properties:
                    img:
                      type: string
                      nullable: true
                    emoji:
                      type: string
                      nullable: true
                    emoji_unicode:
                      type: string
                      nullable: true
                currency:
                  type: object
                  nullable: true
                  properties:
                    name:
                      type: string
                      nullable: true
                    code:
                      type: string
                      nullable: true
                    symbol:
                      type: string
                      nullable: true
        registered_country:
          type: object
          nullable: true
          description: >-
            The country where the IP address is registered (may differ from
            location country for VPNs, proxies, etc.).
          properties:
            name:
              type: string
              nullable: true
              description: Name of the registered country.
            code:
              type: string
              nullable: true
              description: ISO country code of the registered country.
            geoname_id:
              type: integer
              nullable: true
              description: GeoNames ID for the registered country.
        asn:
          type: object
          nullable: true
          properties:
            number:
              type: integer
              nullable: true
            name:
              type: string
              nullable: true
        completion_time:
          type: object
          nullable: true
          properties:
            miliseconds:
              type: number
              nullable: true
            seconds:
              type: number
              nullable: true
    RequestMeta:
      type: object
      properties:
        reqId:
          type: string
          description: Unique request identifier.
        resTime:
          type: number
          description: Response time in milliseconds.
      required:
        - reqId
        - resTime
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: >-
        Use your Ip2Geo secret key (`i2g_sk_...`) for server-side requests, or
        public key (`i2g_pk_...`) for client-side requests. Example: `x-api-key:
        i2g_sk_abc123`.

````