Portkey

App · 20 actions

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

Actions

ActionWhat it does
Create configCreate a config.
Create promptCreate a new prompt.
Delete configDelete a config.
Delete promptDelete a prompt.
Get configGet a config.
Get logGet a specific log.
Get log exportGet a specific logs export.
Get promptGet a prompt by ID or slug.
Get prompt versionGet a specific version of a prompt.
Get virtual keyGet a Virtual Key.
List configsList all configs.
List log exportsGet all logs exports.
List prompt versionsGet all versions of a prompt.
List promptsList prompts.
List virtual keysList All Virtual Keys.
List workspacesGet All Workspaces.
Render promptPrompts Render.
Run promptPrompts Completions.
Update configUpdate a config.
Update promptUpdate a prompt.

Create config

Create a config.

Inputs

Namenametext
Name.
Configconfigobject
Config.
Workspace idworkspace_idtext
optional, when using organisation admin API keys

Outputs

dataobject
Service response.
Example output
{
  "data": {
    "data": {
      "id": "example",
      "version_id": "example"
    },
    "success": false
  }
}

Create prompt

Create a new prompt.

Inputs

NamenametextRequired
Name.
Collection idcollection_idtextRequired
UUID or slug of the collection
StringstringtextRequired
Prompt template in string format
ParametersparametersobjectRequired
Parameters for the prompt
Functionsfunctionslist
Functions for the prompt
Toolstoolslist
Tools for the prompt
Tool choicetool_choiceobject
Tool Choice for the prompt
Modelmodeltext
The model to use for the prompt
Virtual keyvirtual_keytextRequired
The virtual key to use for the prompt
Version descriptionversion_descriptiontext
The description of the prompt version
Template metadatatemplate_metadataobject
Metadata for the prompt

Outputs

dataobject
Service response.
Example output
{
  "data": {
    "id": "example",
    "object": "prompt",
    "slug": "example",
    "version_id": "example"
  }
}

Delete config

Delete a config.

Inputs

SlugslugtextRequired
Slug.

Outputs

dataobject
Service response.
Example output
{
  "data": {}
}

Delete prompt

Delete a prompt.

Inputs

Promptprompt_idtextRequired
Prompt id.

Outputs

dataobject
Service response.
Example output
{
  "data": {}
}

Get config

Get a config.

Inputs

SlugslugtextRequired
Slug.

Outputs

dataobject
Service response.
Example output
{
  "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 idlog_idtextRequired
Log id.
Path formatpath_formattext
Path format.One of: v1, v2. Default: v1.
Created timecreated_atdate and time
Created at.
Typetypetext
Type.One of: hooks.

Outputs

dataobject
Service response.
Example output
{
  "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 idexport_idtextRequired
Export id.

Outputs

dataobject
Service response.
Example output
{
  "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

Promptprompt_idtextRequired
Prompt id.

Outputs

dataobject
Service response.
Example output
{
  "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

Promptprompt_idtextRequired
Prompt id.
Version idversion_idtextRequired
Version id.

Outputs

dataobject
Service response.
Example output
{
  "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

SlugslugtextRequired
Slug.

Outputs

dataobject
Service response.
Example output
{
  "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

dataobject
Service response.
Example output
{
  "data": {
    "data": [],
    "success": false
  }
}

List log exports

Get all logs exports.

Inputs

Workspace idworkspace_idtext
Workspace id.

Outputs

dataobject
Service response.
Example output
{
  "data": {
    "data": [],
    "object": "list",
    "total": 1
  }
}

List prompt versions

Get all versions of a prompt.

Inputs

Promptprompt_idtextRequired
Prompt id.

Outputs

datalist
Service response.
Example output
{
  "data": []
}

List prompts

List prompts.

Inputs

Collection idcollection_idtext
Collection id.
Workspace idworkspace_idtext
Workspace id.
Current pagecurrent_pagenumber
Current page.
Page sizepage_sizenumber
Page size.
Searchsearchtext
Search.

Outputs

dataobject
Service response.
Example output
{
  "data": {
    "data": [],
    "total": 1
  }
}

List virtual keys

List All Virtual Keys.

Inputs

Current pagecurrent_pagenumberRequired
Current page.
Page sizepage_sizenumberRequired
Page size.

Outputs

dataobject
Service response.
Example output
{
  "data": {
    "data": [],
    "object": "list",
    "total": 1
  }
}

List workspaces

Get All Workspaces.

Inputs

Page sizepage_sizenumber
Page size.
Current pagecurrent_pagenumber
Current page.
Namenametext
Name.
Exact nameexact_nametext
Exact name.
Statusstatustext
Status.One of: active, archived.

Outputs

dataobject
Service response.
Example output
{
  "data": {
    "data": [],
    "object": "list",
    "total": 1
  }
}

Render prompt

Prompts Render.

Inputs

Promptprompt_idtextRequired
Prompt id.
VariablesvariablesobjectRequired
Variables to substitute in the prompt template
Hyperparametershyperparametersobject
**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

dataobject
Service response.
Example output
{
  "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

Promptprompt_idtextRequired
Prompt id.
VariablesvariablesobjectRequired
Variables to substitute in the prompt template
Hyperparametershyperparametersobject
**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

dataobject
Service response.
Example output
{
  "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

SlugslugtextRequired
Slug.
Namenametext
Name.
Configconfigobject
Config.
Statusstatustext
Status.

Outputs

dataobject
Service response.
Example output
{
  "data": {
    "data": {
      "version_id": "example"
    },
    "success": false
  }
}

Update prompt

Update a prompt.

Inputs

Promptprompt_idtextRequired
Prompt id.
Namenametext
Name.
Collection idcollection_idtext
Collection id.
Stringstringtext
The prompt template string. When `patch` is `true`, this field is optional and will be inherited from the current latest version if omitted.
Parametersparametersobject
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.
Modelmodeltext
The model identifier. When `patch` is `true`, this field is optional and will be inherited from the current latest version if omitted.
Virtual keyvirtual_keytext
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 descriptionversion_descriptiontext
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.
Functionsfunctionslist
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.
Toolstoolslist
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 choicetool_choiceobject
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 templateis_raw_templatenumber
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 metadataprompt_metadataobject
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

dataobject
Service response.
Example output
{
  "data": {
    "id": "example",
    "prompt_version_id": "example",
    "slug": "example"
  }
}

On this page