HashiCorp Vault AppRole API

AppRole auth method for machine-to-machine authentication

OpenAPI Specification

hvault-approle-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: HashiCorp Vault Vault Auth Methods AppRole API
  description: APIs for authentication methods in HashiCorp Vault including Token, AppRole, Kubernetes, LDAP, JWT/OIDC, GitHub, Userpass, and AWS auth methods. These endpoints handle user and machine authentication to obtain Vault tokens.
  version: '1.0'
  contact:
    name: HashiCorp Support
    email: support@hashicorp.com
    url: https://support.hashicorp.com/
  license:
    name: Business Source License 1.1
    url: https://github.com/hashicorp/vault/blob/main/LICENSE
servers:
- url: https://vault.example.com/v1
  description: Vault Server
security:
- vaultToken: []
tags:
- name: AppRole
  description: AppRole auth method for machine-to-machine authentication
paths:
  /auth/approle/login:
    post:
      operationId: loginWithAppRole
      summary: HashiCorp Vault Login with AppRole
      description: Authenticates with Vault using a role ID and secret ID to obtain a Vault token.
      tags:
      - AppRole
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - role_id
              - secret_id
              properties:
                role_id:
                  type: string
                  description: The AppRole role ID
                secret_id:
                  type: string
                  description: The AppRole secret ID
      responses:
        '200':
          description: Authentication successful
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AuthResponse'
        '400':
          description: Invalid credentials
      security: []
  /auth/approle/role/{role_name}:
    get:
      operationId: readAppRole
      summary: HashiCorp Vault Read AppRole
      description: Reads the properties of the named AppRole.
      tags:
      - AppRole
      parameters:
      - $ref: '#/components/parameters/roleName'
      responses:
        '200':
          description: AppRole configuration
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AppRole'
        '404':
          description: Role not found
    post:
      operationId: createOrUpdateAppRole
      summary: HashiCorp Vault Create or update AppRole
      description: Creates or updates the named AppRole.
      tags:
      - AppRole
      parameters:
      - $ref: '#/components/parameters/roleName'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AppRole'
      responses:
        '204':
          description: AppRole created or updated
        '400':
          description: Invalid request
    delete:
      operationId: deleteAppRole
      summary: HashiCorp Vault Delete AppRole
      description: Deletes the named AppRole.
      tags:
      - AppRole
      parameters:
      - $ref: '#/components/parameters/roleName'
      responses:
        '204':
          description: AppRole deleted
  /auth/approle/role/{role_name}/role-id:
    get:
      operationId: readAppRoleRoleId
      summary: HashiCorp Vault Read AppRole role ID
      description: Returns the role ID of the named AppRole.
      tags:
      - AppRole
      parameters:
      - $ref: '#/components/parameters/roleName'
      responses:
        '200':
          description: Role ID returned
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      role_id:
                        type: string
                        description: The AppRole role ID
  /auth/approle/role/{role_name}/secret-id:
    post:
      operationId: generateAppRoleSecretId
      summary: HashiCorp Vault Generate AppRole secret ID
      description: Generates a new secret ID for the named AppRole.
      tags:
      - AppRole
      parameters:
      - $ref: '#/components/parameters/roleName'
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                metadata:
                  type: string
                  description: JSON-formatted metadata to associate with the secret ID
                cidr_list:
                  type: array
                  items:
                    type: string
                  description: CIDR blocks restricting secret ID usage
                token_bound_cidrs:
                  type: array
                  items:
                    type: string
                  description: CIDR blocks restricting token usage
      responses:
        '200':
          description: Secret ID generated
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      secret_id:
                        type: string
                        description: The generated secret ID
                      secret_id_accessor:
                        type: string
                        description: Accessor for the secret ID
                      secret_id_num_uses:
                        type: integer
                        description: Number of times this secret ID can be used
                      secret_id_ttl:
                        type: integer
                        description: TTL for this secret ID in seconds
components:
  schemas:
    AppRole:
      type: object
      properties:
        bind_secret_id:
          type: boolean
          description: Whether a secret ID is required for login
        secret_id_bound_cidrs:
          type: array
          items:
            type: string
          description: CIDR blocks restricting secret ID usage
        secret_id_num_uses:
          type: integer
          description: Number of times a secret ID can be used
        secret_id_ttl:
          type: string
          description: TTL for secret IDs
        local_secret_ids:
          type: boolean
          description: Whether secret IDs are local to the cluster
        token_ttl:
          type: string
          description: Default token TTL
        token_max_ttl:
          type: string
          description: Maximum token TTL
        token_policies:
          type: array
          items:
            type: string
          description: Policies to attach to tokens
        token_bound_cidrs:
          type: array
          items:
            type: string
          description: CIDR blocks restricting token usage
        token_explicit_max_ttl:
          type: string
          description: Explicit max TTL for tokens
        token_no_default_policy:
          type: boolean
          description: Do not attach the default policy
        token_num_uses:
          type: integer
          description: Maximum number of token uses
        token_period:
          type: string
          description: Token renewal period
        token_type:
          type: string
          enum:
          - default
          - service
          - batch
          description: Token type
    AuthResponse:
      type: object
      properties:
        request_id:
          type: string
          description: Unique request identifier
        lease_id:
          type: string
          description: Lease identifier (empty for auth responses)
        renewable:
          type: boolean
          description: Whether the token is renewable
        lease_duration:
          type: integer
          description: Token TTL in seconds
        auth:
          type: object
          properties:
            client_token:
              type: string
              description: The Vault authentication token
            accessor:
              type: string
              description: Token accessor
            policies:
              type: array
              items:
                type: string
              description: Policies attached to the token
            token_policies:
              type: array
              items:
                type: string
              description: Token-specific policies
            identity_policies:
              type: array
              items:
                type: string
              description: Identity-derived policies
            metadata:
              type: object
              additionalProperties:
                type: string
              description: Metadata associated with the token
            lease_duration:
              type: integer
              description: Token TTL in seconds
            renewable:
              type: boolean
              description: Whether the token is renewable
            entity_id:
              type: string
              description: Identity entity ID
            token_type:
              type: string
              description: Type of token (service, batch)
            orphan:
              type: boolean
              description: Whether the token is an orphan
  parameters:
    roleName:
      name: role_name
      in: path
      required: true
      description: Name of the role
      schema:
        type: string
  securitySchemes:
    vaultToken:
      type: apiKey
      in: header
      name: X-Vault-Token
      description: Vault authentication token
externalDocs:
  description: Vault Auth Methods API Documentation
  url: https://developer.hashicorp.com/vault/api-docs/auth