> ## Documentation Index
> Fetch the complete documentation index at: https://lightdash-mintlify-9d6f9427.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Create warehouse credentials

> Create user warehouse credentials



## OpenAPI

````yaml https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/user/warehouseCredentials
openapi: 3.0.0
info:
  title: Lightdash API
  version: 0.3249.0
  description: >
    Open API documentation for all public Lightdash API endpoints. #
    Authentication Before you get started, you might need to create a Personal
    Access Token to authenticate via the API. You can create a token by
    following this guide: https://docs.lightdash.com/references/personal_tokens
  license:
    name: MIT
  contact:
    name: Lightdash Support
    email: support@lightdash.com
    url: https://docs.lightdash.com/help-and-contact/contact/contact_info/
servers:
  - url: /
security: []
tags:
  - name: My Account
    description: These routes allow users to manage their own user account.
  - name: Organizations
    description: >-
      Each user is a member of a single organization. These routes allow users
      to manage their organization. Most actions are only available to admin
      users.
  - name: Projects
    description: >-
      Projects belong to a single organization. These routes allow users to
      manage their projects, browse content, and execute queries. Users inside
      an organization might have access to a project from an organization-level
      role or they might be granted access to a project directly.
  - name: Spaces
    description: >-
      Spaces allow you to organize charts and dashboards within a project. They
      also allow granular access to content by allowing you to create private
      spaces, which are only accessible to the creator and admins.
  - name: Roles & Permissions
    description: >-
      These routes allow users to manage roles and permissions for their
      organization.
    externalDocs:
      url: https://docs.lightdash.com/references/roles
  - name: Query
    description: >-
      These routes allow users to execute and manage queries against their data
      warehouse. This includes metric queries, SQL queries, and retrieving query
      results.
paths:
  /api/v1/user/warehouseCredentials:
    post:
      tags:
        - My Account
      summary: Create warehouse credentials
      description: Create user warehouse credentials
      operationId: createWarehouseCredentials
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpsertUserWarehouseCredentials'
      responses:
        '200':
          description: Ok
          content:
            application/json:
              schema:
                properties:
                  results:
                    $ref: '#/components/schemas/UserWarehouseCredentials'
                  status:
                    type: string
                    enum:
                      - ok
                    nullable: false
                required:
                  - results
                  - status
                type: object
        default:
          description: Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorPayload'
      security: []
components:
  schemas:
    UpsertUserWarehouseCredentials:
      properties:
        credentials:
          anyOf:
            - $ref: >-
                #/components/schemas/Pick_CreateRedshiftCredentials.type-or-user-or-password_
            - $ref: >-
                #/components/schemas/Pick_CreatePostgresCredentials.type-or-user-or-password_
            - $ref: >-
                #/components/schemas/Pick_CreateSnowflakeCredentials.type-or-user-or-password-or-authenticationType-or-refreshToken_
            - $ref: >-
                #/components/schemas/Pick_CreateTrinoCredentials.type-or-user-or-password_
            - $ref: >-
                #/components/schemas/Pick_CreateClickhouseCredentials.type-or-user-or-password_
            - $ref: >-
                #/components/schemas/Pick_CreateBigqueryCredentials.type-or-keyfileContents-or-authenticationType_
            - allOf:
                - $ref: >-
                    #/components/schemas/Pick_CreateDatabricksCredentials.type-or-personalAccessToken-or-authenticationType-or-refreshToken_
                - $ref: >-
                    #/components/schemas/Partial_Pick_CreateDatabricksCredentials.database-or-serverHostName-or-httpPath-or-oauthClientId__
            - $ref: >-
                #/components/schemas/Pick_CreateAthenaCredentials.type-or-accessKeyId-or-secretAccessKey_
            - $ref: >-
                #/components/schemas/Pick_CreateDuckdbMotherduckCredentials.type-or-token_
        name:
          type: string
      required:
        - credentials
        - name
      type: object
    UserWarehouseCredentials:
      properties:
        project:
          allOf:
            - $ref: '#/components/schemas/UserWarehouseCredentialsProject'
          nullable: true
        credentials:
          anyOf:
            - $ref: >-
                #/components/schemas/Pick_CreateRedshiftCredentials-or-CreatePostgresCredentials-or-CreateSnowflakeCredentials-or-CreateTrinoCredentials-or-CreateClickhouseCredentials.type-or-user_
            - $ref: '#/components/schemas/Pick_CreateBigqueryCredentials.type_'
            - $ref: '#/components/schemas/Pick_CreateDatabricksCredentials.type_'
            - $ref: '#/components/schemas/Pick_CreateAthenaCredentials.type_'
            - $ref: '#/components/schemas/Pick_CreateDuckdbCredentials.type_'
        updatedAt:
          type: string
          format: date-time
        createdAt:
          type: string
          format: date-time
        name:
          type: string
        userUuid:
          type: string
        uuid:
          type: string
      required:
        - project
        - credentials
        - updatedAt
        - createdAt
        - name
        - userUuid
        - uuid
      type: object
    ApiErrorPayload:
      properties:
        error:
          properties:
            data:
              $ref: '#/components/schemas/AnyType'
              description: Optional data containing details of the error
            message:
              type: string
              description: A friendly message summarising the error
            name:
              type: string
              description: Unique name for the type of error
            statusCode:
              type: number
              format: integer
              description: HTTP status code
          required:
            - name
            - statusCode
          type: object
        status:
          type: string
          enum:
            - error
          nullable: false
      required:
        - error
        - status
      type: object
      description: |-
        The Error object is returned from the api any time there is an error.
        The message contains
    Pick_CreateRedshiftCredentials.type-or-user-or-password_:
      properties:
        type:
          $ref: '#/components/schemas/WarehouseTypes.REDSHIFT'
        user:
          type: string
        password:
          type: string
      required:
        - type
        - user
      type: object
      description: From T, pick a set of properties whose keys are in the union K
    Pick_CreatePostgresCredentials.type-or-user-or-password_:
      properties:
        type:
          $ref: '#/components/schemas/WarehouseTypes.POSTGRES'
        user:
          type: string
        password:
          type: string
      required:
        - type
        - user
        - password
      type: object
      description: From T, pick a set of properties whose keys are in the union K
    Pick_CreateSnowflakeCredentials.type-or-user-or-password-or-authenticationType-or-refreshToken_:
      properties:
        type:
          $ref: '#/components/schemas/WarehouseTypes.SNOWFLAKE'
        user:
          type: string
        password:
          type: string
        refreshToken:
          type: string
        authenticationType:
          $ref: '#/components/schemas/SnowflakeAuthenticationType'
      required:
        - type
        - user
      type: object
      description: From T, pick a set of properties whose keys are in the union K
    Pick_CreateTrinoCredentials.type-or-user-or-password_:
      properties:
        type:
          $ref: '#/components/schemas/WarehouseTypes.TRINO'
        user:
          type: string
        password:
          type: string
      required:
        - type
        - user
        - password
      type: object
      description: From T, pick a set of properties whose keys are in the union K
    Pick_CreateClickhouseCredentials.type-or-user-or-password_:
      properties:
        type:
          $ref: '#/components/schemas/WarehouseTypes.CLICKHOUSE'
        user:
          type: string
        password:
          type: string
      required:
        - type
        - user
        - password
      type: object
      description: From T, pick a set of properties whose keys are in the union K
    Pick_CreateBigqueryCredentials.type-or-keyfileContents-or-authenticationType_:
      properties:
        type:
          $ref: '#/components/schemas/WarehouseTypes.BIGQUERY'
        keyfileContents:
          $ref: '#/components/schemas/Record_string.string_'
        authenticationType:
          $ref: '#/components/schemas/BigqueryAuthenticationType'
      required:
        - type
        - keyfileContents
      type: object
      description: From T, pick a set of properties whose keys are in the union K
    Pick_CreateDatabricksCredentials.type-or-personalAccessToken-or-authenticationType-or-refreshToken_:
      properties:
        type:
          $ref: '#/components/schemas/WarehouseTypes.DATABRICKS'
        personalAccessToken:
          type: string
        refreshToken:
          type: string
        authenticationType:
          $ref: '#/components/schemas/DatabricksAuthenticationType'
      required:
        - type
      type: object
      description: From T, pick a set of properties whose keys are in the union K
    Partial_Pick_CreateDatabricksCredentials.database-or-serverHostName-or-httpPath-or-oauthClientId__:
      properties:
        oauthClientId:
          type: string
        database:
          type: string
        serverHostName:
          type: string
        httpPath:
          type: string
      type: object
      description: Make all properties in T optional
    Pick_CreateAthenaCredentials.type-or-accessKeyId-or-secretAccessKey_:
      properties:
        type:
          $ref: '#/components/schemas/WarehouseTypes.ATHENA'
        accessKeyId:
          type: string
        secretAccessKey:
          type: string
      required:
        - type
      type: object
      description: From T, pick a set of properties whose keys are in the union K
    Pick_CreateDuckdbMotherduckCredentials.type-or-token_:
      properties:
        type:
          $ref: '#/components/schemas/WarehouseTypes.DUCKDB'
        token:
          type: string
      required:
        - type
        - token
      type: object
      description: From T, pick a set of properties whose keys are in the union K
    UserWarehouseCredentialsProject:
      properties:
        type:
          $ref: '#/components/schemas/ProjectType'
        name:
          type: string
        projectUuid:
          type: string
      required:
        - type
        - name
        - projectUuid
      type: object
    Pick_CreateRedshiftCredentials-or-CreatePostgresCredentials-or-CreateSnowflakeCredentials-or-CreateTrinoCredentials-or-CreateClickhouseCredentials.type-or-user_:
      properties:
        type:
          anyOf:
            - $ref: '#/components/schemas/WarehouseTypes.POSTGRES'
            - $ref: '#/components/schemas/WarehouseTypes.REDSHIFT'
            - $ref: '#/components/schemas/WarehouseTypes.SNOWFLAKE'
            - $ref: '#/components/schemas/WarehouseTypes.TRINO'
            - $ref: '#/components/schemas/WarehouseTypes.CLICKHOUSE'
        user:
          type: string
      required:
        - type
        - user
      type: object
      description: From T, pick a set of properties whose keys are in the union K
    Pick_CreateBigqueryCredentials.type_:
      properties:
        type:
          $ref: '#/components/schemas/WarehouseTypes.BIGQUERY'
      required:
        - type
      type: object
      description: From T, pick a set of properties whose keys are in the union K
    Pick_CreateDatabricksCredentials.type_:
      properties:
        type:
          $ref: '#/components/schemas/WarehouseTypes.DATABRICKS'
      required:
        - type
      type: object
      description: From T, pick a set of properties whose keys are in the union K
    Pick_CreateAthenaCredentials.type_:
      properties:
        type:
          $ref: '#/components/schemas/WarehouseTypes.ATHENA'
      required:
        - type
      type: object
      description: From T, pick a set of properties whose keys are in the union K
    Pick_CreateDuckdbCredentials.type_:
      properties:
        type:
          $ref: '#/components/schemas/WarehouseTypes.DUCKDB'
      required:
        - type
      type: object
      description: From T, pick a set of properties whose keys are in the union K
    AnyType:
      description: |-
        This AnyType is an alias for any
        The goal is to make it easier to identify any type in the codebase
        without having to eslint-disable all the time
        These are only used on legacy `any` types, don't use it for new types.
        This is added on a separate file to avoid circular dependencies.
    WarehouseTypes.REDSHIFT:
      enum:
        - redshift
      type: string
    WarehouseTypes.POSTGRES:
      enum:
        - postgres
      type: string
    WarehouseTypes.SNOWFLAKE:
      enum:
        - snowflake
      type: string
    SnowflakeAuthenticationType:
      enum:
        - password
        - private_key
        - sso
        - external_browser
        - none
      type: string
    WarehouseTypes.TRINO:
      enum:
        - trino
      type: string
    WarehouseTypes.CLICKHOUSE:
      enum:
        - clickhouse
      type: string
    WarehouseTypes.BIGQUERY:
      enum:
        - bigquery
      type: string
    Record_string.string_:
      properties: {}
      additionalProperties:
        type: string
      type: object
      description: Construct a type with a set of properties K of type T
    BigqueryAuthenticationType:
      enum:
        - sso
        - private_key
        - adc
      type: string
    WarehouseTypes.DATABRICKS:
      enum:
        - databricks
      type: string
    DatabricksAuthenticationType:
      enum:
        - personal_access_token
        - oauth_m2m
        - oauth_u2m
      type: string
    WarehouseTypes.ATHENA:
      enum:
        - athena
      type: string
    WarehouseTypes.DUCKDB:
      enum:
        - duckdb
      type: string
    ProjectType:
      enum:
        - DEFAULT
        - PREVIEW
      type: string

````