---
title: "Create a new Target associated with an Upstream"
method: POST
path: "/{workspace}/upstreams/{UpstreamIdForTarget}/targets"
tags: ["Targets"]
---

# Create a new Target associated with an Upstream

`POST /{workspace}/upstreams/{UpstreamIdForTarget}/targets`

Create a new Target associated with an Upstream

## Path parameters

- `UpstreamIdForTarget` string, required
- `workspace` string, required

## Request body

- TargetWithoutParents — A target is an ip address/hostname with a port that identifies an instance of a backend service. Every upstream can have many targets, and the targets can be dynamically added, modified, or deleted. Changes take effect on the fly. To disable a target, post a new one with `weight=0`; alternatively, use the `DELETE` convenience method to accomplish the same. The current target object definition is the one with the latest `created_at`.
  - `created_at` number, nullable — Unix epoch when the resource was created.
  - `failover` boolean, nullable — Whether to use this target only as backup or not.
  - `id` string, nullable — A string representing a UUID (universally unique identifier).
  - `tags` string[], nullable — An optional set of strings associated with the Target for grouping and filtering.
  - `target` string, nullable, required — The target address (ip or hostname) and port. If the hostname resolves to an SRV record, the `port` value will be overridden by the value from the DNS record.
  - `updated_at` number, nullable — Unix epoch when the resource was last updated.
  - `upstream` object, nullable — The unique identifier or the name of the upstream for which to update the target.
    - `id` string
  - `weight` integer, nullable — The weight this target gets within the upstream loadbalancer (`0`-`65535`). If the hostname resolves to an SRV record, the `weight` value will be overridden by the value from the DNS record.

## Response `201`

Successfully created Target

- Target — A target is an ip address/hostname with a port that identifies an instance of a backend service. Every upstream can have many targets, and the targets can be dynamically added, modified, or deleted. Changes take effect on the fly. To disable a target, post a new one with `weight=0`; alternatively, use the `DELETE` convenience method to accomplish the same. The current target object definition is the one with the latest `created_at`.
  - `created_at` number, nullable — Unix epoch when the resource was created.
  - `failover` boolean, nullable — Whether to use this target only as backup or not.
  - `id` string, nullable — A string representing a UUID (universally unique identifier).
  - `tags` string[], nullable — An optional set of strings associated with the Target for grouping and filtering.
  - `target` string, nullable, required — The target address (ip or hostname) and port. If the hostname resolves to an SRV record, the `port` value will be overridden by the value from the DNS record.
  - `updated_at` number, nullable — Unix epoch when the resource was last updated.
  - `upstream` object, nullable — The unique identifier or the name of the upstream for which to update the target.
    - `id` string
  - `weight` integer, nullable — The weight this target gets within the upstream loadbalancer (`0`-`65535`). If the hostname resolves to an SRV record, the `weight` value will be overridden by the value from the DNS record.

---

[API](https://skmtc.net/kong/apis/kong-enterprise-admin-api.md) · [All operations](https://skmtc.net/kong/apis/kong-enterprise-admin-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/kong/kong-enterprise-admin-api/revisions/28b1f8a59cdc/schema)
