> ## Documentation Index
> Fetch the complete documentation index at: https://docs.lerian.studio/llms.txt
> Use this file to discover all available pages before exploring further.

# Create a Provider

> Creates a new Email or SMS Provider. For Category=Email, clientId is REQUIRED and is the from address: Casdoor sends every message from it, so a provider without it cannot send at all. It must be a valid email address already verified with the provider (a SendGrid Sender Identity). title and content are the verification-code email template; both default to a neutral built-in when omitted, and content must contain exactly one %s where the code is substituted.



## OpenAPI

````yaml /es/openapi/v3-current/AM-identity.yaml post /v1/providers
openapi: 3.0.1
info:
  contact: {}
  description: This is a swagger documentation for the Identity API
  termsOfService: http://swagger.io/terms/
  title: Identity API
  version: 1.0.0
servers:
  - url: //localhost:4001/
security: []
paths:
  /v1/providers:
    post:
      tags:
        - Providers
      summary: Create a Provider
      description: >-
        Creates a new Email or SMS Provider. For Category=Email, clientId is
        REQUIRED and is the from address: Casdoor sends every message from it,
        so a provider without it cannot send at all. It must be a valid email
        address already verified with the provider (a SendGrid Sender Identity).
        title and content are the verification-code email template; both default
        to a neutral built-in when omitted, and content must contain exactly one
        %s where the code is substituted.
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ProviderInput'
        description: Provider Input
        required: true
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProviderResponse'
          description: Created
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/pkg.HTTPError'
          description: Bad Request
        '409':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/pkg.HTTPError'
          description: Conflict
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/pkg.HTTPError'
          description: Internal Server Error
      security:
        - BearerAuth: []
components:
  schemas:
    ProviderInput:
      description: ProviderInput payload
      example:
        disableSsl: true
        templateCode: templateCode
        clientSecret2: clientSecret2
        title: title
        type: type
        content: content
        intranetEndpoint: intranetEndpoint
        endpoint: endpoint
        appId: appId
        host: host
        clientSecret: clientSecret
        customUserInfoUrl: customUserInfoUrl
        clientId: noreply@example.com
        signName: signName
        method: method
        receiver: receiver
        issuerUrl: issuerUrl
        customTokenUrl: customTokenUrl
        clientId2: clientId2
        customAuthUrl: customAuthUrl
        port: 0
        regionId: regionId
        domain: domain
        name: name
        subType: subType
        scopes: scopes
        category: category
      properties:
        appId:
          type: string
        category:
          type: string
        clientId:
          description: >-
            ClientId is the FROM ADDRESS for Category=Email — required, and must
            be a

            valid email address verified with the provider (a SendGrid Sender

            Identity). Casdoor sends every email from this value; a provider
            without

            it cannot send at all. For Category=OAuth it is the OAuth client ID,
            and

            for Category=SMS the provider account identifier (a Twilio Account
            SID).
          example: noreply@example.com
          type: string
        clientId2:
          type: string
        clientSecret:
          description: '#nosec G117 -- auth service, field must be in JSON response'
          type: string
        clientSecret2:
          description: '#nosec G117 -- auth service, field must be in JSON response'
          type: string
        content:
          description: >-
            Content is the HTML body of the verification-code email for

            Category=Email. Casdoor substitutes the code into a single %s, so
            the body

            must contain exactly one. A neutral default body is applied when
            omitted.
          type: string
        customAuthUrl:
          type: string
        customTokenUrl:
          type: string
        customUserInfoUrl:
          type: string
        disableSsl:
          type: boolean
        domain:
          type: string
        endpoint:
          type: string
        host:
          type: string
        intranetEndpoint:
          type: string
        issuerUrl:
          type: string
        method:
          type: string
        name:
          type: string
        port:
          type: integer
        receiver:
          type: string
        regionId:
          type: string
        scopes:
          type: string
        signName:
          type: string
        subType:
          type: string
        templateCode:
          type: string
        title:
          description: |-
            Title is the subject line of the verification-code email for
            Category=Email. Defaults to "Here is your code" when omitted.
          type: string
        type:
          description: >-
            Type is the provider type. For Category=SMS the canonical Casdoor
            value is

            "Twilio SMS"; the legacy "Twilio" is still accepted and is
            normalised to

            the canonical form before the provider is stored.
          type: string
      required:
        - category
        - name
        - type
      type: object
    ProviderResponse:
      description: ProviderResponse payload
      example:
        disableSsl: true
        templateCode: templateCode
        title: title
        type: SendGrid
        content: content
        createdAt: '2021-09-01T00:00:00.000Z'
        intranetEndpoint: intranetEndpoint
        endpoint: endpoint
        appId: appId
        host: host
        customUserInfoUrl: customUserInfoUrl
        id: 00000000-0000-0000-0000-000000000000
        clientId: clientId
        signName: signName
        method: method
        receiver: receiver
        issuerUrl: issuerUrl
        customTokenUrl: customTokenUrl
        clientId2: clientId2
        customAuthUrl: customAuthUrl
        providerUrl: providerUrl
        port: 0
        regionId: regionId
        domain: domain
        name: SMTP Corp
        subType: subType
        scopes: scopes
        category: Email
      properties:
        appId:
          type: string
        category:
          example: Email
          type: string
        clientId:
          type: string
        clientId2:
          type: string
        content:
          type: string
        createdAt:
          example: '2021-09-01T00:00:00.000Z'
          type: string
        customAuthUrl:
          type: string
        customTokenUrl:
          type: string
        customUserInfoUrl:
          type: string
        disableSsl:
          type: boolean
        domain:
          type: string
        endpoint:
          type: string
        host:
          type: string
        id:
          example: 00000000-0000-0000-0000-000000000000
          type: string
        intranetEndpoint:
          type: string
        issuerUrl:
          type: string
        method:
          type: string
        name:
          example: SMTP Corp
          type: string
        port:
          type: integer
        providerUrl:
          type: string
        receiver:
          type: string
        regionId:
          type: string
        scopes:
          type: string
        signName:
          type: string
        subType:
          type: string
        templateCode:
          type: string
        title:
          type: string
        type:
          description: >-
            Type is the provider type exactly as stored in Casdoor. SMS
            providers

            created before the canonical "Twilio SMS" was adopted are still
            stored as

            "Twilio", so both values can appear here.
          example: SendGrid
          type: string
      type: object
    pkg.HTTPError:
      properties:
        code:
          type: string
        entityType:
          type: string
        err:
          type: object
        message:
          type: string
        title:
          type: string
      type: object
  securitySchemes:
    BearerAuth:
      description: 'Bearer authentication. Send Authorization: Bearer <token>.'
      in: header
      name: Authorization
      type: apiKey

````