---
title: "POST /target-create-openai"
method: POST
path: "/target-create-openai"
tags: ["Targets"]
---

# POST /target-create-openai

`POST /target-create-openai`

## Request

- Base URL: `https://api.akeyless.io`
- URL: `https://api.akeyless.io/target-create-openai`
- Auth: none declared

## Request body

- TargetCreateOpenAI: targetCreateOpenAI is a command that creates a new openai target
  - `api-key` string: API key for OpenAI
  - `api-key-id` string: API key ID
  - `codex-oauth-access-token` string: Codex OAuth access token (auth.json tokens.access_token), used when codex-oauth-mode=chatgpt_oauth
  - `codex-oauth-account-id` string: Codex OAuth account id (auth.json tokens.account_id), used when codex-oauth-mode=chatgpt_oauth
  - `codex-oauth-mode` string: Auth mode: empty (default, static api-key) or chatgpt_oauth
  - `codex-oauth-refresh-token` string: Codex OAuth refresh token (auth.json tokens.refresh_token), used when codex-oauth-mode=chatgpt_oauth
  - `delete_protection` string: Protection from accidental deletion of this object [true/false]
  - `description` string: Description of the object
  - `json` boolean: Set output format to JSON
  - `key` string: The name of a key that used to encrypt the target secret value (if empty, the account default protectionKey key will be used)
  - `lock-on-read` string: Lock this secret after each successful value read
  - `lock-ttl` string: Lock TTL in minutes
  - `max-versions` string: Set the maximum number of versions, limited by the account settings defaults.
  - `model` string: Default model to use with OpenAI
  - `name` string, required: Target name
  - `openai-url` string: Base URL of the OpenAI API
  - `organization-id` string: Organization ID
  - `rotate-on-unlock` string: Rotate this secret after it is unlocked
  - `token` string: Authentication token (see `/auth` and `/configure`)
  - `uid-token` string: The universal identity token, Required only for universal_identity authentication

## Response `201`

targetCreateOpenAIResponse wraps response body.

- TargetCreateOutput
  - `target_id` integer

## Other responses

- `default`: errorResponse wraps any error to return it as a JSON object with one "error" field.

---

[API](https://skmtc.dev/akeyless/apis/infrastructure-connectivity.md) - [All operations](https://skmtc.dev/akeyless/apis/infrastructure-connectivity/llms.txt) - [OpenAPI document](https://skmtc.dev/akeyless/apis/infrastructure-connectivity/revisions/62dc62fea89d?raw)
