# Portkey

> Manage prompts and gateway configurations, inspect logs and run saved prompts.

App · 20 actions. Web page: https://docs.lodol.com/docs/integrations/portkey

## Actions

### Create config

Create a config.

**Inputs**

- Name (`name`, text): Name.
- Config (`config`, object): Config.
- Workspace id (`workspace_id`, text): optional, when using organisation admin API keys

**Outputs**

- `data` (object): Service response.

**Example output**

```json
{
  "data": {
    "data": {
      "id": "example",
      "version_id": "example"
    },
    "success": false
  }
}
```

### Create prompt

Create a new prompt.

**Inputs**

- Name (`name`, text, required): Name.
- Collection id (`collection_id`, text, required): UUID or slug of the collection
- String (`string`, text, required): Prompt template in string format
- Parameters (`parameters`, object, required): Parameters for the prompt
- Functions (`functions`, list): Functions for the prompt
- Tools (`tools`, list): Tools for the prompt
- Tool choice (`tool_choice`, object): Tool Choice for the prompt
- Model (`model`, text): The model to use for the prompt
- Virtual key (`virtual_key`, text, required): The virtual key to use for the prompt
- Version description (`version_description`, text): The description of the prompt version
- Template metadata (`template_metadata`, object): Metadata for the prompt

**Outputs**

- `data` (object): Service response.

**Example output**

```json
{
  "data": {
    "id": "example",
    "object": "prompt",
    "slug": "example",
    "version_id": "example"
  }
}
```

### Delete config

Delete a config.

**Inputs**

- Slug (`slug`, text, required): Slug.

**Outputs**

- `data` (object): Service response.

**Example output**

```json
{
  "data": {}
}
```

### Delete prompt

Delete a prompt.

**Inputs**

- Prompt (`prompt_id`, text, required): Prompt id.

**Outputs**

- `data` (object): Service response.

**Example output**

```json
{
  "data": {}
}
```

### Get config

Get a config.

**Inputs**

- Slug (`slug`, text, required): Slug.

**Outputs**

- `data` (object): Service response.

**Example output**

```json
{
  "data": {
    "data": {
      "config": {
        "cache": {
          "max_age": 1,
          "mode": "example"
        },
        "retry": {
          "attempts": 1,
          "on_status_codes": []
        },
        "strategy": {
          "mode": "example"
        },
        "targets": []
      }
    },
    "success": false
  }
}
```

### Get log

Get a specific log.

**Inputs**

- Log id (`log_id`, text, required): Log id.
- Path format (`path_format`, text): Path format. One of: `v1`, `v2`. Default: `v1`.
- Created time (`created_at`, date and time): Created at.
- Type (`type`, text): Type. One of: `hooks`.

**Outputs**

- `data` (object): Service response.

**Example output**

```json
{
  "data": {
    "_id": "example",
    "created_at": "2026-11-01T12:00:00Z",
    "finalUntransformedRequest": {
      "body": {},
      "headers": {},
      "method": "example",
      "url": "example"
    },
    "metrics": {
      "ai_model": "example",
      "ai_org": "example",
      "api_key_id": "example",
      "cache_processing_time": 1,
      "cache_status": "example",
      "cache_type": "example",
      "config": "example",
      "config_id": "example",
      "config_version_id": "example",
      "cost": 1.0,
      "cost_currency": "example",
      "created_at": "2026-11-01T12:00:00Z",
      "gateway_processing_time": 1,
      "id": "example",
      "internal_trace_id": "example",
      "is_proxy_call": false,
      "is_success": false,
      "last_used_option_index": 1,
      "log_store_file_path_format": "example",
      "metadata.key": [],
      "metadata.value": [],
      "mode": "example",
      "organisation_id": "example",
      "organisation_name": "example",
      "parent_span_id": "example",
      "pre_processing_time": 1,
      "prompt_id": "example",
      "prompt_slug": "example",
      "prompt_version_id": "example",
      "req_units": 1.0,
      "request_method": "example",
      "request_parsing_time": 1,
      "request_url": "example",
      "res_units": 1.0,
      "response_parsing_time": 1,
      "response_status_code": 1,
      "response_time": 1,
      "retry_success_count": 1,
      "runtime": "example",
      "runtime_version": "example",
      "sdk_version": "example",
      "source": "example",
      "span_id": "example",
      "span_name": "example",
      "stream_mode": 1,
      "total_units": 1.0,
      "trace_id": "example",
      "upstream_response_time": 1,
      "virtual_key": "example",
      "workspace_slug": "example"
    },
    "organisation_id": "example",
    "originalResponse": {
      "body": {},
      "headers": {},
      "method": "example",
      "url": "example"
    },
    "request": {
      "body": {},
      "headers": {},
      "method": "GET",
      "portkeyHeaders": {},
      "url": "example"
    },
    "response": {
      "body": {},
      "headers": {},
      "lastUsedOptionJsonPath": "example",
      "responseTime": 1,
      "status": 1
    },
    "transformedRequest": {
      "body": {},
      "headers": {},
      "method": "example",
      "url": "example"
    }
  }
}
```

### Get log export

Get a specific logs export.

**Inputs**

- Export id (`export_id`, text, required): Export id.

**Outputs**

- `data` (object): Service response.

**Example output**

```json
{
  "data": {
    "created_at": "2026-11-01T12:00:00Z",
    "created_by": "example",
    "description": "example",
    "filters": {
      "ai_model": "example",
      "ai_org_model": "example",
      "completion_token_max": 1,
      "completion_token_min": 1,
      "configs": "example",
      "cost_max": 1.0,
      "cost_min": 1.0,
      "current_page": 1.0,
      "metadata": {},
      "page_size": 1.0,
      "prompt_slug": "example",
      "prompt_token_max": 1,
      "prompt_token_min": 1,
      "status_code": "example",
      "time_of_generation_max": "2026-11-01T12:00:00Z",
      "time_of_generation_min": "2026-11-01T12:00:00Z",
      "total_units_max": 1,
      "total_units_min": 1,
      "trace_id": "example",
      "virtual_keys": "example",
      "weighted_feedback_max": 1.0,
      "weighted_feedback_min": 1.0,
      "workspace_slug": "example"
    },
    "id": "example",
    "last_updated_at": "2026-11-01T12:00:00Z",
    "object": "export",
    "organisation_id": "example",
    "requested_data": [],
    "status": "draft",
    "workspace_id": "example"
  }
}
```

### Get prompt

Get a prompt by ID or slug.

**Inputs**

- Prompt (`prompt_id`, text, required): Prompt id.

**Outputs**

- `data` (object): Service response.

**Example output**

```json
{
  "data": {
    "collection_id": "example",
    "created_at": "2026-11-01T12:00:00Z",
    "functions": [],
    "id": "example",
    "is_raw_template": false,
    "last_updated_at": "2026-11-01T12:00:00Z",
    "model": "example",
    "name": "example",
    "parameters": {},
    "prompt_version": 1.0,
    "prompt_version_description": "example",
    "prompt_version_id": "example",
    "prompt_version_label_id": "example",
    "prompt_version_status": "active",
    "slug": "example",
    "status": "example",
    "string": "example",
    "template_metadata": {},
    "tool_choice": {},
    "tools": [],
    "virtual_key": "example"
  }
}
```

### Get prompt version

Get a specific version of a prompt.

**Inputs**

- Prompt (`prompt_id`, text, required): Prompt id.
- Version id (`version_id`, text, required): Version id.

**Outputs**

- `data` (object): Service response.

**Example output**

```json
{
  "data": {
    "collection_id": "example",
    "created_at": "2026-11-01T12:00:00Z",
    "functions": [],
    "id": "example",
    "is_raw_template": false,
    "last_updated_at": "2026-11-01T12:00:00Z",
    "model": "example",
    "name": "example",
    "parameters": {},
    "prompt_version": 1.0,
    "prompt_version_description": "example",
    "prompt_version_id": "example",
    "prompt_version_label_id": "example",
    "prompt_version_status": "active",
    "slug": "example",
    "status": "example",
    "string": "example",
    "template_metadata": {},
    "tool_choice": {},
    "tools": [],
    "virtual_key": "example"
  }
}
```

### Get virtual key

Get a Virtual Key.

**Inputs**

- Slug (`slug`, text, required): Slug.

**Outputs**

- `data` (object): Service response.

**Example output**

```json
{
  "data": {
    "created_at": "2026-11-01T12:00:00Z",
    "expires_at": "2026-11-01T12:00:00Z",
    "model_config": {},
    "name": "example",
    "note": "example",
    "object": "virtual-key",
    "rate_limits": [],
    "reset_usage": 1.0,
    "secret_mappings": [],
    "slug": "example",
    "status": "active",
    "usage_limits": {
      "alert_threshold": 1,
      "credit_limit": 1,
      "next_usage_reset_at": "2026-11-01T12:00:00Z",
      "periodic_reset": "monthly",
      "periodic_reset_days": 1,
      "type": "cost"
    }
  }
}
```

### List configs

List all configs.

**Inputs**: None.

**Outputs**

- `data` (object): Service response.

**Example output**

```json
{
  "data": {
    "data": [],
    "success": false
  }
}
```

### List log exports

Get all logs exports.

**Inputs**

- Workspace id (`workspace_id`, text): Workspace id.

**Outputs**

- `data` (object): Service response.

**Example output**

```json
{
  "data": {
    "data": [],
    "object": "list",
    "total": 1
  }
}
```

### List prompt versions

Get all versions of a prompt.

**Inputs**

- Prompt (`prompt_id`, text, required): Prompt id.

**Outputs**

- `data` (list): Service response.

**Example output**

```json
{
  "data": []
}
```

### List prompts

List prompts.

**Inputs**

- Collection id (`collection_id`, text): Collection id.
- Workspace id (`workspace_id`, text): Workspace id.
- Current page (`current_page`, number): Current page.
- Page size (`page_size`, number): Page size.
- Search (`search`, text): Search.

**Outputs**

- `data` (object): Service response.

**Example output**

```json
{
  "data": {
    "data": [],
    "total": 1
  }
}
```

### List virtual keys

List All Virtual Keys.

**Inputs**

- Current page (`current_page`, number, required): Current page.
- Page size (`page_size`, number, required): Page size.

**Outputs**

- `data` (object): Service response.

**Example output**

```json
{
  "data": {
    "data": [],
    "object": "list",
    "total": 1
  }
}
```

### List workspaces

Get All Workspaces.

**Inputs**

- Page size (`page_size`, number): Page size.
- Current page (`current_page`, number): Current page.
- Name (`name`, text): Name.
- Exact name (`exact_name`, text): Exact name.
- Status (`status`, text): Status. One of: `active`, `archived`.

**Outputs**

- `data` (object): Service response.

**Example output**

```json
{
  "data": {
    "data": [],
    "object": "list",
    "total": 1
  }
}
```

### Render prompt

Prompts Render.

**Inputs**

- Prompt (`prompt_id`, text, required): Prompt id.
- Variables (`variables`, object, required): Variables to substitute in the prompt template
- Hyperparameters (`hyperparameters`, object): **Note**: All hyperparameters are optional. Pass them at the root level, and not nested under `hyperparameters`. Their grouping here is for educational purposes only.

**Outputs**

- `data` (object): Service response.

**Example output**

```json
{
  "data": {
    "data": {
      "frequency_penalty": 1.0,
      "function_call": "none",
      "functions": [],
      "logit_bias": {},
      "logprobs": false,
      "max_completion_tokens": 1,
      "max_tokens": 1,
      "messages": [],
      "model": "example",
      "n": 1,
      "parallel_tool_calls": false,
      "presence_penalty": 1.0,
      "response_format": {
        "type": "text"
      },
      "seed": 1,
      "stop": "example",
      "stream": false,
      "stream_options": {
        "include_usage": false
      },
      "temperature": 1.0,
      "thinking": {
        "budget_tokens": 1,
        "type": "enabled"
      },
      "tool_choice": "none",
      "tools": [],
      "top_logprobs": 1,
      "top_p": 1.0,
      "user": "example"
    },
    "success": false
  }
}
```

### Run prompt

Prompts Completions.

**Inputs**

- Prompt (`prompt_id`, text, required): Prompt id.
- Variables (`variables`, object, required): Variables to substitute in the prompt template
- Hyperparameters (`hyperparameters`, object): **Note**: All hyperparameters are optional. Pass them at the root level, and not nested under `hyperparameters`. Their grouping here is for educational purposes only.

**Outputs**

- `data` (object): Service response.

**Example output**

```json
{
  "data": {
    "body": {
      "choices": [],
      "created": 1,
      "id": "example",
      "model": "example",
      "object": "chat.completion",
      "system_fingerprint": "example",
      "usage": {
        "completion_tokens": 1,
        "completion_tokens_details": {
          "accepted_prediction_tokens": 1,
          "reasoning_tokens": 1,
          "rejected_prediction_tokens": 1
        },
        "prompt_tokens": 1,
        "prompt_tokens_details": {
          "cached_tokens": 1
        },
        "total_tokens": 1
      }
    },
    "headers": {},
    "status": "example"
  }
}
```

### Update config

Update a config.

**Inputs**

- Slug (`slug`, text, required): Slug.
- Name (`name`, text): Name.
- Config (`config`, object): Config.
- Status (`status`, text): Status.

**Outputs**

- `data` (object): Service response.

**Example output**

```json
{
  "data": {
    "data": {
      "version_id": "example"
    },
    "success": false
  }
}
```

### Update prompt

Update a prompt.

**Inputs**

- Prompt (`prompt_id`, text, required): Prompt id.
- Name (`name`, text): Name.
- Collection id (`collection_id`, text): Collection id.
- String (`string`, text): The prompt template string. When `patch` is `true`, this field is optional and will be inherited from the current latest version if omitted.
- Parameters (`parameters`, object): Model parameters (e.g. temperature, max_tokens). When `patch` is `true`, this field is optional and will be inherited from the current latest version if omitted.
- Model (`model`, text): The model identifier. When `patch` is `true`, this field is optional and will be inherited from the current latest version if omitted.
- Virtual key (`virtual_key`, text): The virtual key to associate with this version. When `patch` is `true`, this field is optional and will be inherited from the current latest version if omitted.
- Version description (`version_description`, text): A human-readable description for this version. When `patch` is `true`, this field is optional and will be inherited from the current latest version if omitted.
- Functions (`functions`, list): Function definitions available to the model. When `patch` is `true`, this field is optional and will be inherited from the current latest version if omitted.
- Tools (`tools`, list): Tool definitions available to the model. When `patch` is `true`, this field is optional and will be inherited from the current latest version if omitted.
- Tool choice (`tool_choice`, object): Controls which tool the model uses. When `patch` is `true`, this field is optional and will be inherited from the current latest version if omitted.
- Is raw template (`is_raw_template`, number): Whether the template string is raw (1) or processed (0). When `patch` is `true`, this field is optional and will be inherited from the current latest version if omitted. One of: `0`, `1`.
- Prompt metadata (`prompt_metadata`, object): Additional metadata for the prompt version. When `patch` is `true`, this field is optional and will be inherited from the current latest version if omitted.

**Outputs**

- `data` (object): Service response.

**Example output**

```json
{
  "data": {
    "id": "example",
    "prompt_version_id": "example",
    "slug": "example"
  }
}
```
