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

# Create a provider

> Create a new provider configuration. The `provider` field must be a known Courier provider key (see catalog).



## OpenAPI

````yaml /openapi-specs/openapi.documented.yml post /providers
openapi: 3.0.1
info:
  title: Courier
  description: The Courier REST API for sending and managing notifications across channels.
  version: 0.0.1
servers:
  - url: https://api.courier.com
    description: Production
security: []
paths:
  /providers:
    post:
      tags:
        - Providers
      summary: Create a provider
      description: >-
        Create a new provider configuration. The `provider` field must be a
        known Courier provider key (see catalog).
      operationId: providers_create
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ProvidersCreateRequest'
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Provider'
              examples:
                Example:
                  value:
                    id: prov_5e2b2615
                    title: Example Name
                    provider: string
                    alias: string
                    settings: {}
                    created: 1
                    updated: 1
        '400':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BadRequest'
              examples:
                Example:
                  value:
                    message: Example message text
                    type: invalid_request_error
      security:
        - BearerAuth: []
      x-codeSamples:
        - lang: JavaScript
          source: >-
            import Courier from '@trycourier/courier';


            const client = new Courier({
              apiKey: process.env['COURIER_API_KEY'], // This is the default and can be omitted
            });


            const provider = await client.providers.create({ provider:
            'provider' });


            console.log(provider.id);
        - lang: Python
          source: |-
            import os
            from courier import Courier

            client = Courier(
                api_key=os.environ.get("COURIER_API_KEY"),  # This is the default and can be omitted
            )
            provider = client.providers.create(
                provider="provider",
            )
            print(provider.id)
        - lang: Go
          source: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/trycourier/courier-go\"\n\t\"github.com/trycourier/courier-go/option\"\n)\n\nfunc main() {\n\tclient := courier.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tprovider, err := client.Providers.New(context.TODO(), courier.ProviderNewParams{\n\t\tProvider: \"provider\",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", provider.ID)\n}\n"
        - lang: Java
          source: |-
            package com.courier.example;

            import com.courier.client.CourierClient;
            import com.courier.client.okhttp.CourierOkHttpClient;
            import com.courier.models.providers.Provider;
            import com.courier.models.providers.ProviderCreateParams;

            public final class Main {
                private Main() {}

                public static void main(String[] args) {
                    CourierClient client = CourierOkHttpClient.fromEnv();

                    ProviderCreateParams params = ProviderCreateParams.builder()
                        .provider("provider")
                        .build();
                    Provider provider = client.providers().create(params);
                }
            }
        - lang: Ruby
          source: |-
            require "courier"

            courier = Courier::Client.new(api_key: "My API Key")

            provider = courier.providers.create(provider: "provider")

            puts(provider)
        - lang: PHP
          source: >-
            <?php


            require_once dirname(__DIR__) . '/vendor/autoload.php';


            use Courier\Client;

            use Courier\Core\Exceptions\APIException;


            $client = new Client(apiKey: getenv('COURIER_API_KEY') ?: 'My API
            Key');


            try {
              $provider = $client->providers->create(
                provider: 'provider',
                alias: 'alias',
                settings: ['foo' => 'bar'],
                title: 'title',
              );

              var_dump($provider);
            } catch (APIException $e) {
              echo $e->getMessage();
            }
        - lang: C#
          source: |-
            using System;
            using TryCourier;
            using TryCourier.Models.Providers;

            CourierClient client = new();

            ProviderCreateParams parameters = new() { Provider = "provider" };

            var provider = await client.Providers.Create(parameters);

            Console.WriteLine(provider);
        - lang: CLI
          source: |-
            courier providers create \
              --api-key 'My API Key' \
              --provider provider
components:
  schemas:
    ProvidersCreateRequest:
      title: ProvidersCreateRequest
      type: object
      description: Request body for creating a new provider configuration.
      properties:
        provider:
          type: string
          maxLength: 128
          description: >-
            The provider key identifying the type (e.g. "sendgrid", "twilio").
            Must be a known Courier provider — see the catalog endpoint for
            valid keys.
        title:
          type: string
          description: Optional display title. Omit to use "Default Configuration".
        alias:
          type: string
          description: Optional alias for this configuration.
        settings:
          type: object
          description: >-
            Provider-specific settings (snake_case keys). Defaults to an empty
            object when omitted. Use the catalog endpoint to discover required
            fields for a given provider — omitting a required field returns a
            400 validation error.
          additionalProperties: true
      required:
        - provider
    Provider:
      title: Provider
      type: object
      description: A configured provider in the workspace.
      properties:
        id:
          type: string
          description: A unique identifier for the provider configuration.
        title:
          type: string
          description: >-
            Display title. Defaults to "Default Configuration" when not
            explicitly set.
        provider:
          type: string
          description: The provider key (e.g. "sendgrid", "twilio", "slack").
        alias:
          type: string
          description: Optional alias for this configuration.
        settings:
          type: object
          description: Provider-specific settings (snake_case keys on the wire).
          additionalProperties: true
        created:
          type: integer
          description: Unix timestamp (ms) of when the provider was created.
        updated:
          type: integer
          nullable: true
          description: Unix timestamp (ms) of when the provider was last updated.
      required:
        - id
        - title
        - provider
        - settings
        - created
    BadRequest:
      title: BadRequest
      type: object
      properties:
        type:
          type: string
          enum:
            - invalid_request_error
      required:
        - type
      allOf:
        - $ref: '#/components/schemas/BaseError'
    BaseError:
      title: BaseError
      type: object
      properties:
        message:
          type: string
          description: A message describing the error that occurred.
      required:
        - message
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer

````