Services /
Update service ports
Required permission
Project > Services > General > Update
Path parameters
projectId
string requiredID of the project
serviceId
string requiredID of the service
Request body
- {object}
ports
[array] requiredAn array of ports to replace or update existing ports with.
- {object}
id
stringThe id of an existing port. Pass this when changing in order to keep security configurations.
pattern^[a-z]-?[a-z0-9]+(-[a-z0-9]+)*$name
string requiredThe name used to identify the port.
min length3max length8pattern^[a-zA-Z](-?[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*)?$internalPort
integer requiredThe port number.
min1max65535public
booleanIf true, the port will be exposed publicly.
protocol
string requiredThe protocol to use for the port. Public ports only support
HTTP
andHTTP/2
.one ofHTTP, HTTP/2, TCP, UDPdomains
[array]An array of domains to redirect to this port. Each domain must first be verified and registered to your account.
- string
A domain to redirect to this port.
security
{object}credentials
[array]An array of credentials to access the service.
- {object}
username
string requiredThe username to access the service
min length3max length39pattern^[a-zA-Z](-?[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*)?$password
string requiredThe password to access the service with this username.
type
string requiredThe type of authentication used
one ofbasic-authpolicies
[array]An array of IP address policies.
- {object}
addresses
[array] requiredAn array of IP addresses used for this rule
- string
An IP address used by this rule
action
string requiredThe action for this rule.
one ofALLOW, DENYdisableNfDomain
booleanDisable routing on the default code.run domain for public HTTP ports with custom domains.
Response body
- {object}
Response object.
data
{object} requiredResult data.
POST /v1/projects/{projectId}/services/{serviceId}/ports
Example request
curl --header "Content-Type: application/json" \
--header "Authorization: Bearer NORTHFLANK_API_TOKEN" \
--request POST \
--data '{"ports":[{"id":"p01","name":"p01","internalPort":12345,"public":true,"protocol":"HTTP","domains":["app.example.com"],"security":{"credentials":[{"username":"admin","password":"password123","type":"basic-auth"}],"policies":[{"addresses":["127.0.0.1"],"action":"DENY"}]}}]}' \
https://api.northflank.com/v1/projects/{projectId}/services/{serviceId}/ports
Example response
200 OK
JSON
{
"data": {}
}
Example response
404 Not Found