# Create portfolios order

Places a buy or sell portfolio order for the specified account, distributing the cash amount across instruments according to the account's allocation weights.
One underlying instrument order is generated per instrument in the allocation.
See the Portfolios guide ([TOL](https://docs.upvest.co/products/tol/guides/portfolios) / [BYOL](https://docs.upvest.co/products/byol/guides/portfolios)) for implementation details.

Endpoint: POST /portfolios/orders
Version: 1.136.0
Security: oauth-client-credentials

## Header parameters:

  - `idempotency-key` (string, required)
    A UUID to be used as an idempotency key.  This prevents a duplicate request from being replayed.
https://docs.upvest.co/documentation/concepts/api_concepts/idempotency

  - `upvest-client-id` (string, required)
    Your client ID, issued by Upvest. Identifies the client making the request. Universally Unique Identifier (UUID).

  - `Authorization` (string, required)
    Bearer (access) token from the OAuth flow with correct scopes.
https://datatracker.ietf.org/doc/html/rfc6750

  - `signature` (string, required)
    https://tools.ietf.org/id/draft-ietf-httpbis-message-signatures-01.html#name-the-signature-http-header

  - `signature-input` (string, required)
    https://tools.ietf.org/id/draft-ietf-httpbis-message-signatures-01.html#name-the-signature-input-http-he

  - `upvest-api-version` (string)
    Upvest API version (Note: Do not include quotation marks)

## Request fields (application/json):

  - `user_id` (string, required)
    Unique identifier of the user, as a UUID.

  - `account_id` (string, required)
    Account unique identifier.

  - `cash_amount` (string, required)

  - `currency` (string, required)
    Alphabetic three-letter [ISO 4217](https://www.iso.org/iso-4217-currency-codes.html) currency code.
* EUR - Euro
* GBP - Pound Sterling
    Enum: "EUR", "GBP"

  - `side` (string, required)
    Side of the portfolio order.
* BUY -
* SELL -
    Enum: "BUY", "SELL"

  - `post_tax` (boolean)
    Cash amount is post-tax value

## Response 200 fields (application/json):

  - `id` (string, required)
    Universally Unique Identifier (UUID) of a portfolio order.

  - `created_at` (string, required)
    Date and time when the resource was created. [RFC 3339-5](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6), [ISO8601 UTC](https://www.iso.org/iso-8601-date-and-time-format.html)

  - `updated_at` (string, required)
    Date and time when the resource was last updated. [RFC 3339-5](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6), [ISO8601 UTC](https://www.iso.org/iso-8601-date-and-time-format.html)

  - `user_id` (string)
    Unique identifier of the user, as a UUID.

  - `account_id` (string, required)
    Account unique identifier.

  - `allocation_id` (string)
    Universally Unique Identifier (UUID) of a portfolio allocation.

  - `cash_amount` (string, required)

  - `currency` (string, required)
    Alphabetic three-letter [ISO 4217](https://www.iso.org/iso-4217-currency-codes.html) currency code.
* EUR - Euro
* GBP - Pound Sterling
    Enum: "EUR", "GBP"

  - `status` (string, required)
    Execution status of the Portfolio Order.
* NEW -
* PROCESSING -
* FILLED -
* SETTLED -
* CANCELLED -
    Enum: "NEW", "PROCESSING", "FILLED", "SETTLED", "CANCELLED"

  - `type` (string)
    Type of the Portfolio Order.
* BUY -
* SELL -
* REBALANCING -
    Enum: "BUY", "SELL", "REBALANCING"

  - `post_tax` (boolean, required)
    Cash amount is post-tax value

  - `orders` (array, required)
    Orders associated with this portfolio order

  - `orders.id` (string, required)
    Unique identifier for an order. Universally Unique Identifier (UUID).

  - `orders.side` (string, required)
    Side of the portfolio order.
* BUY -
* SELL -
    Enum: "BUY", "SELL"

  - `orders.status` (string, required)
    The execution status of the order.
* NEW — the order has been received and validated, awaiting routing.
* PROCESSING — the order is being routed for execution.
* FILLED — the order has been fully executed.
* CANCELLED — the order was cancelled before being fully executed.
    Enum: "NEW", "PROCESSING", "FILLED", "CANCELLED"

  - `client_reference` (string, required)
    A reference string provided by the client to correlate the portfolio order with a record in the client's own system.

  - `initiation_flow` (string, required)
    What triggered the order creation .
* API -
* SAVINGS_PLAN -
    Enum: "API", "SAVINGS_PLAN"

  - `cancellation_reason` (string)
    Explains the reason why the order was cancelled .
* ACCOUNT_IS_EMPTY -
* CANCELLED_BY_CLIENT -
* CANCELLED_BY_UPVEST -
* PORTFOLIO_IS_BALANCED -
* SELL_LIMIT_EXCEEDED -
    Enum: "ACCOUNT_IS_EMPTY", "CANCELLED_BY_CLIENT", "CANCELLED_BY_UPVEST", "PORTFOLIO_IS_BALANCED", "SELL_LIMIT_EXCEEDED"

  - `cancellation_details` (string)

## Response 400 fields (application/problem+json):

  - `type` (string, required)
    URL to a document describing the error condition.

  - `status` (integer, required)
    Transmission of the HTTP status code so that all information can be found in one place, but also to correct changes in the status code due to the use of proxy servers.

  - `title` (string)
    A short, human-readable title for the general error type; the title should not change for given types.

  - `detail` (string)
    A human-readable description of the specific error.

  - `instance` (string)
    This optional key may be present, with a unique URI for the specific error; this will often point to an error log for that specific response.

  - `request_id` (string)
    Correlation ID for the original request.

## Response 401 fields (application/problem+json):

  - `type` (string, required)
    URL to a document describing the error condition.

  - `status` (integer, required)
    Transmission of the HTTP status code so that all information can be found in one place, but also to correct changes in the status code due to the use of proxy servers.

  - `title` (string)
    A short, human-readable title for the general error type; the title should not change for given types.

  - `detail` (string)
    A human-readable description of the specific error.

  - `instance` (string)
    This optional key may be present, with a unique URI for the specific error; this will often point to an error log for that specific response.

  - `request_id` (string)
    Correlation ID for the original request.

## Response 403 fields (application/problem+json):

  - `type` (string, required)
    URL to a document describing the error condition.

  - `status` (integer, required)
    Transmission of the HTTP status code so that all information can be found in one place, but also to correct changes in the status code due to the use of proxy servers.

  - `title` (string)
    A short, human-readable title for the general error type; the title should not change for given types.

  - `detail` (string)
    A human-readable description of the specific error.

  - `instance` (string)
    This optional key may be present, with a unique URI for the specific error; this will often point to an error log for that specific response.

  - `request_id` (string)
    Correlation ID for the original request.

## Response 404 fields (application/problem+json):

  - `type` (string, required)
    URL to a document describing the error condition.

  - `status` (integer, required)
    Transmission of the HTTP status code so that all information can be found in one place, but also to correct changes in the status code due to the use of proxy servers.

  - `title` (string)
    A short, human-readable title for the general error type; the title should not change for given types.

  - `detail` (string)
    A human-readable description of the specific error.

  - `instance` (string)
    This optional key may be present, with a unique URI for the specific error; this will often point to an error log for that specific response.

  - `request_id` (string)
    Correlation ID for the original request.

## Response 406 fields (application/problem+json):

  - `type` (string, required)
    URL to a document describing the error condition.

  - `status` (integer, required)
    Transmission of the HTTP status code so that all information can be found in one place, but also to correct changes in the status code due to the use of proxy servers.

  - `title` (string)
    A short, human-readable title for the general error type; the title should not change for given types.

  - `detail` (string)
    A human-readable description of the specific error.

  - `instance` (string)
    This optional key may be present, with a unique URI for the specific error; this will often point to an error log for that specific response.

  - `request_id` (string)
    Correlation ID for the original request.

## Response 429 fields (application/problem+json):

  - `type` (string, required)
    URL to a document describing the error condition.

  - `status` (integer, required)
    Transmission of the HTTP status code so that all information can be found in one place, but also to correct changes in the status code due to the use of proxy servers.

  - `title` (string)
    A short, human-readable title for the general error type; the title should not change for given types.

  - `detail` (string)
    A human-readable description of the specific error.

  - `instance` (string)
    This optional key may be present, with a unique URI for the specific error; this will often point to an error log for that specific response.

  - `request_id` (string)
    Correlation ID for the original request.

## Response 500 fields (application/problem+json):

  - `type` (string, required)
    URL to a document describing the error condition.

  - `status` (integer, required)
    Transmission of the HTTP status code so that all information can be found in one place, but also to correct changes in the status code due to the use of proxy servers.

  - `title` (string)
    A short, human-readable title for the general error type; the title should not change for given types.

  - `detail` (string)
    A human-readable description of the specific error.

  - `instance` (string)
    This optional key may be present, with a unique URI for the specific error; this will often point to an error log for that specific response.

  - `request_id` (string)
    Correlation ID for the original request.

## Response 503 fields (application/problem+json):

  - `type` (string, required)
    URL to a document describing the error condition.

  - `status` (integer, required)
    Transmission of the HTTP status code so that all information can be found in one place, but also to correct changes in the status code due to the use of proxy servers.

  - `title` (string)
    A short, human-readable title for the general error type; the title should not change for given types.

  - `detail` (string)
    A human-readable description of the specific error.

  - `instance` (string)
    This optional key may be present, with a unique URI for the specific error; this will often point to an error log for that specific response.

  - `request_id` (string)
    Correlation ID for the original request.

## Response 504 fields (application/problem+json):

  - `type` (string, required)
    URL to a document describing the error condition.

  - `status` (integer, required)
    Transmission of the HTTP status code so that all information can be found in one place, but also to correct changes in the status code due to the use of proxy servers.

  - `title` (string)
    A short, human-readable title for the general error type; the title should not change for given types.

  - `detail` (string)
    A human-readable description of the specific error.

  - `instance` (string)
    This optional key may be present, with a unique URI for the specific error; this will often point to an error log for that specific response.

  - `request_id` (string)
    Correlation ID for the original request.

