geoLocation
    • PDF

    geoLocation

    • PDF

    Article Summary

    Request

    API URL

    GET https://geolocation.apigw.ntruss.com/geolocation/v2/geoLocation
    

    Request Header

    HeaderDescription
    x-ncp-apigw-timestampIt is the number of milliseconds that have elapsed since January 1, 1970 00:00:00 UTC. If the time difference with the API Gateway server is more than 5 minutes, the request is considered invalid.
    x-ncp-apigw-timestamp:{Timestamp}
    x-ncp-iam-access-keyAccess Key ID issued from the NAVER Cloud Platform portal.
    x-ncp-iam-access-key:{Sub Account Access Key}
    x-ncp-apigw-signature-v2Signature encrypted with your Access Key ID and Secret Key.
    x-ncp-apigw-signature-v2:{API Gateway Signature}

    Request Parameters

    ParameterRequiredTypeLimitationDescription
    ipYStringIPv4 - WikipediaUser’s IP address based on which you want to know location information.
    encNStringutf8 (default) or euckrEncoding type of the response result
    extNStringt or f (default)Indicates whether to include extra information.
    t: Include
    f: Not include
    responseFormatTypeNStringxml (default) or jsonFormat type of the response result

    Response

    PropertyTypeDescription
    requestIdStringAPI request ID
    returnCodeString0 if it is normal, and an error code if not.
    countryStringCounty code, including EU (Europe), AP (Asia, Australia), A1 (Anonymous Proxy), A2 (Satellite provider), O1 (Other Country) as well as https://en.wikipedia.org/wiki/ISO_3166.
    codeStringAdministrative code defined by the Ministry of Government Administration and Home Affairs in Korea.
    r1StringProvince, metropolitan city, state
    r2StringSi, Gun, Gu
    r3StringDong, Myeon, Eup
    latNumberLatitude
    longNumberLongitude
    netStringNetwork operator name

    Example

    Request Example

    • Korea, ext=f, xml
    <getLocationResponse>
         <requestId>c4e52003-7879-4216-8eb5-66c93acfd0d2</requestId>
         <returnCode>0</returnCode>
         <geoLocation>
           <country>KR</country>
           <code>4113558000</code>
           <r1>경기도</r1>
           <r2>성남시 분당구</r2>
         </geoLocation>
    </getLocationResponse>
    
    • Korea, ext=f, json
    {
    	"returnCode": 0,
    	"requestId": "c4e52003-7879-4216-8eb5-66c93acfd0d2",
    	"geoLocation": {
    		"country": "KR",
    		"code": "4113558000",
    		"r1": "경기도",
    		"r2": "성남시 분당구"
    	}
    }
    
    • Outside of Korea, ext=f, xml
    <getLocationResponse>
         <requestId>c4e52003-7879-4216-8eb5-66c93acfd0d2</requestId>
         <returnCode>0</returnCode>
         <geoLocation>
           <country>US</country>
           <code/>
           <r1>California</r1>
           <r2>San Francisco</r2>
         </geoLocation>
    </getLocationResponse>
    
    • Outside of Korea, ext=f, json
    {
    	"returnCode": 0,
    	"requestId": "c4e52003-7879-4216-8eb5-66c93acfd0d2",
    	"geoLocation": {
    		"country": "US",
    		"code": "",
    		"r1": "California",
    		"r2": "San Francisco"
    	}
    }
    
    • Korea, ext=t, xml
    <getLocationResponse>
         <requestId>c4e52003-7879-4216-8eb5-66c93acfd0d2</requestId>
         <returnCode>0</returnCode>
         <geoLocation>
           <country>KR</country>
           <code>4113558000</code>
           <r1>경기도</r1>
           <r2>성남시 분당구</r2>
           <r3>서현1동</r3>
           <lat>37.3829030</lat>
           <long>127.126290</long>
           <net>Korea Net</net>
         </geoLocation>
    </getLocationResponse>
    
    • Korea, ext=t, json
    {
    	"returnCode": 0,
    	"requestId": "c4e52003-7879-4216-8eb5-66c93acfd0d2",
    	"geoLocation": {
    		"country": "KR",
    		"code": "4113558000",
    		"r1": "경기도",
    		"r2": "성남시 분당구",
            "r3": "서현1동",
            "lat": 37.3829030,
            "long": 127.126290,
            "net": "Korea Net"
    	}
    }
    
    • Outside of Korea, ext=t, xml
    <getLocationResponse>
         <requestId>c4e52003-7879-4216-8eb5-66c93acfd0d2</requestId>
         <returnCode>0</returnCode>
         <geoLocation>
           <country>US</country>
           <code/>
           <r1>California</r1>
           <r2>San Francisco</r2>
           <r3></r3>
           <lat>37.769700</lat>
           <long>-122.393300</long>
           <net>Fastly</net>
         </geoLocation>
    </getLocationResponse>
    
    • Outside of Korea, ext=t, json
    {
    	"returnCode": 0,
    	"requestId": "c4e52003-7879-4216-8eb5-66c93acfd0d2",
    	"geoLocation": {
    		"country": "US",
    		"code": "",
    		"r1": "California",
    		"r2": "San Francisco",
            "r3": "",
            "lat": 37.769700,
            "long": -122.393300,
            "net": "Fastly"
    	}
    }
    

    Error Codes

    Error codeResponse messageDescription
    131000No EntryThis error occurs when geolocation information that matches the requested IP address is not found. Try again with another IP address.
    131001Invalid IPThis error occurs when the requested IP address is not a public IP address or is invalid. For information on the valid IP address format, refer to IPv4 - Wikipedia.
    131002Internal Server ErrorThis error occurs due to internal errors of the GeoLocation server. If the problem persists, Support > Contact Us.
    131003Quota Limit ReachedThis error occurs when the number of API calls reaches the defined quota limit. Go to NAVER Cloud Platform’s console, and click GeoLocation > Quota Setting to change the quota.
    131004Subscription RequiredGo to NAVER Cloud Platform’s console, and click GeoLocation > Subscription to request the GeoLocation service.

    For other response codes, refer to NAVER Cloud Platform > Error handling.

    Sample Example


    Was this article helpful?

    What's Next
    Changing your password will log you out immediately. Use the new password to log back in.
    First name must have atleast 2 characters. Numbers and special characters are not allowed.
    Last name must have atleast 1 characters. Numbers and special characters are not allowed.
    Enter a valid email
    Enter a valid password
    Your profile has been successfully updated.