Skip to main content

Update Static IPs

API to update the primary and optional secondary static IP addresses for your user account (user-level registration). The same IPs apply across your API usage regardless of which OAuth client issued the token.

Platform rules (aligned with My Apps guide):

  • Static IPs can only be changed once per calendar week.
  • After a successful update, the existing access tokens are invalidated and you need to generate a new one.
  • When enforcement is active, orders may be rejected unless traffic originates from a registered IP.
  • primary_ip and secondary_ip must use standard IPv4 or IPv6 address notation.

Request

curl --location --request PUT 'https://api.upstox.com/v2/user/ip' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {your_access_token}' \
--data '{
"primary_ip": "203.0.113.10",
"secondary_ip": "203.0.113.11"
}'

For additional samples in various languages, please refer to the Sample code section on this page.


Request Body

NameRequiredTypeDescription
primary_iptruestringPrimary static IP (IPv4 or IPv6, standard notation) from which API order traffic must originate once enforcement is active.
secondary_ipfalsestringOptional secondary static IP (IPv4 or IPv6, standard notation) for backup or failover. Omit the field if you do not need a secondary IP.
Responses

Response Body

{
"status": "success",
"data": {
"user_id": "858644",
"primary_ip": "122.181.101.247",
"secondary_ip": "128.1.1.2",
"primary_ip_updated_at": "2026-04-03 17:17:50",
"secondary_ip_updated_at": "2026-04-03 17:17:50",
"access_tokens_invalidated": true
}
}
NameTypeDescription
statusstringOutcome of the request. Typically success for successful operations.
dataobjectUser-level static IP configuration for the authenticated account after the update.
data.user_idstringUpstox user_id for the authenticated account.
data.primary_ipstringRegistered primary static IP (IPv4 or IPv6, standard notation).
data.secondary_ipstringRegistered secondary static IP, if configured (IPv4 or IPv6, standard notation). May be omitted or null if not set.
data.primary_ip_updated_atstringTimestamp when the primary IP was last updated (server time).
data.secondary_ip_updated_atstringTimestamp when the secondary IP was last updated, if configured. May be omitted or null if never set.
data.access_tokens_invalidatedbooleanWhen true, existing access tokens were invalidated; complete the OAuth flow again for a new token.

Sample Code

Update static IPs for the authenticated user

import requests

url = 'https://api.upstox.com/v2/user/ip'
headers = {
'Accept': 'application/json',
'Content-Type': 'application/json',
'Authorization': 'Bearer {your_access_token}'
}

data = {
'primary_ip': '203.0.113.10',
'secondary_ip': '203.0.113.11'
}

response = requests.put(url, headers=headers, json=data)
print(response.text)
Loading...