---
title: "Create a shared credential for a provider"
method: POST
path: "/v2/directories/{directoryId}/vault/providers/{providerId}/credentials"
tags: ["TokenVaultProviders"]
---

# Create a shared credential for a provider

`POST /v2/directories/{directoryId}/vault/providers/{providerId}/credentials`

## Request

- Base URL: `https://global.api.konghq.com`
- URL: `https://global.api.konghq.com/v2/directories/{directoryId}/vault/providers/{providerId}/credentials`
- Auth: one of:
  - HTTP bearer
  - HTTP bearer
  - HTTP bearer
  - HTTP bearer

Creates a shared credential for a provider. For a static_secret provider, stores
a literal secret value (at most one, a second create returns 409). For a shared
authorization_code provider, mints an OAuth enrollment URL for an
admin to complete once instead of accepting a secret value.

## Path parameters

- `directoryId` string, uuid, required
- `providerId` string, uuid, required

## Request body

- SetVaultProviderCredentialBody: The secret to store. Required and used verbatim for a static_secret provider. Must be omitted for a shared authorization_code provider, where the response instead carries an enrollment_url for an admin to complete OAuth consent.
  - `secret` string: Pre-issued static credential (API key, PAT, etc.). Stored encrypted, never returned in read APIs.
  - `selector` string: CEL expression deciding which callers this credential applies to. Omit to make it the provider's default, which applies to every caller and is considered after all the others.
  - `priority` integer: Order in which this credential is considered, lowest first. Required with a selector, and must be omitted without one.

## Response `201`

Shared credential metadata (never includes the value)

- VaultProviderCredentialShared
  - `id` string, uuid: Contains a unique identifier used for this resource.
  - `created_at` string, date-time
  - `updated_at` string, date-time
  - `credential_type` 'shared', required
  - `selector` string, nullable: CEL expression deciding which callers this credential applies to. Omit to make it the provider's default, which applies to every caller and is considered after all the others.
  - `priority` integer, nullable: Order in which this credential is considered, lowest first. Required with a selector, and must be omitted without one.
  - `status` 'pending' | 'active', required: "pending" until admin enrollment completes; "active" once the secret exists.
  - `enrollment_url` string, nullable: URL to complete OAuth consent. Fresh on every get-by-id call; set on create for a shared authorization_code provider. Omitted from list responses.

## Other responses

- `400`: Bad Request
- `401`: Unauthorized
- `403`: Forbidden
- `404`: Not Found
- `409`: Conflict

## Changes

- **2026-11-05** `f018071a4515`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/kong/apis/konnect-api/changes/v2/directories/:directoryId/vault/providers/:providerId/credentials/post.md)

---

[API](https://skmtc.dev/kong/apis/konnect-api.md) - [All operations](https://skmtc.dev/kong/apis/konnect-api/llms.txt) - [OpenAPI document](https://skmtc.dev/kong/apis/konnect-api/revisions/5da43f6209ea?raw)
