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

# Create a source

> This endpoint creates a source



## OpenAPI

````yaml post /v1/projects/{projectID}/sources
openapi: 3.0.0
info:
  contact:
    email: support@getconvoy.io
    name: Convoy Support
    url: https://getconvoy.io/docs
  description: >-
    Convoy is a fast and secure webhooks proxy. This document contains
    datastore.s API specification.
  license:
    name: Mozilla Public License 2.0
    url: https://www.mozilla.org/en-US/MPL/2.0/
  termsOfService: https://getconvoy.io/terms
  title: Convoy API Reference
  version: 24.1.4
servers:
  - url: https://us.getconvoy.cloud/api
    description: US Region
  - url: https://eu.getconvoy.cloud/api
    description: EU Region
security: []
tags:
  - description: Subscription related APIs
    name: Subscriptions
  - description: Endpoint related APIs
    name: Endpoints
  - description: Event related APIs
    name: Events
  - description: Source related APIs
    name: Sources
  - description: EventDelivery related APIs
    name: Event Deliveries
  - description: Delivery Attempt related APIs
    name: Delivery Attempts
  - description: Portal Links related APIs
    name: Portal Links
  - description: Meta Events related APIs
    name: Meta Events
  - description: Event Types related APIs
    name: EventTypes
  - description: Filters related APIs
    name: Filters
  - description: Onboard related APIs
    name: Onboard
paths:
  /v1/projects/{projectID}/sources:
    post:
      tags:
        - Sources
      summary: Create a source
      description: This endpoint creates a source
      operationId: CreateSource
      parameters:
        - description: Project ID
          in: path
          name: projectID
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/models.CreateSource'
        description: Source Details
        required: true
      responses:
        '201':
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/util.ServerResponse'
                  - properties:
                      data:
                        $ref: '#/components/schemas/models.SourceResponse'
                    type: object
          description: Created
        '400':
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/util.ServerResponse'
                  - properties:
                      data:
                        $ref: '#/components/schemas/handlers.Stub'
                    type: object
          description: Bad Request
        '401':
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/util.ServerResponse'
                  - properties:
                      data:
                        $ref: '#/components/schemas/handlers.Stub'
                    type: object
          description: Unauthorized
        '404':
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/util.ServerResponse'
                  - properties:
                      data:
                        $ref: '#/components/schemas/handlers.Stub'
                    type: object
          description: Not Found
      security:
        - ApiKeyAuth: []
components:
  schemas:
    models.CreateSource:
      properties:
        body_function:
          description: |-
            Function is a javascript function used to mutate the payload
            immediately after ingesting an event
          type: string
        custom_response:
          allOf:
            - $ref: '#/components/schemas/models.CustomResponse'
          description: |-
            Custom response is used to define a custom response for incoming
            webhooks project sources only.
        header_function:
          description: |-
            Function is a javascript function used to mutate the headers
            immediately after ingesting an event
          type: string
        idempotency_keys:
          description: >-
            IdempotencyKeys are used to specify parts of a webhook request to
            uniquely

            identify the event in an incoming webhooks project.
          items:
            type: string
          type: array
        name:
          description: Source name.
          type: string
        provider:
          allOf:
            - $ref: '#/components/schemas/datastore.SourceProvider'
          description: Use this to specify one of our predefined source types.
        pub_sub:
          allOf:
            - $ref: '#/components/schemas/models.PubSubConfig'
          description: |-
            PubSub are used to specify message broker sources for outgoing
            webhooks projects.
        type:
          allOf:
            - $ref: '#/components/schemas/datastore.SourceType'
          description: Source Type.
        verifier:
          allOf:
            - $ref: '#/components/schemas/models.VerifierConfig'
          description: |-
            Verifiers are used to verify webhook events ingested in incoming
            webhooks projects. If set, type is required and match the verifier
            type object you choose.
      type: object
    util.ServerResponse:
      properties:
        message:
          type: string
        status:
          type: boolean
      type: object
    models.SourceResponse:
      properties:
        body_function:
          type: string
        created_at:
          type: string
        custom_response:
          $ref: '#/components/schemas/datastore.CustomResponse'
        deleted_at:
          type: string
        forward_headers:
          items:
            type: string
          type: array
        header_function:
          type: string
        idempotency_keys:
          items:
            type: string
          type: array
        is_disabled:
          type: boolean
        mask_id:
          type: string
        name:
          type: string
        project_id:
          type: string
        provider:
          $ref: '#/components/schemas/datastore.SourceProvider'
        provider_config:
          $ref: '#/components/schemas/datastore.ProviderConfig'
        pub_sub:
          $ref: '#/components/schemas/datastore.PubSubConfig'
        type:
          $ref: '#/components/schemas/datastore.SourceType'
        uid:
          type: string
        updated_at:
          type: string
        url:
          type: string
        verifier:
          $ref: '#/components/schemas/datastore.VerifierConfig'
      type: object
    handlers.Stub:
      type: object
    models.CustomResponse:
      properties:
        body:
          type: string
        content_type:
          type: string
      type: object
    datastore.SourceProvider:
      enum:
        - github
        - twitter
        - shopify
      type: string
      x-enum-varnames:
        - GithubSourceProvider
        - TwitterSourceProvider
        - ShopifySourceProvider
    models.PubSubConfig:
      properties:
        amqp:
          $ref: '#/components/schemas/models.AmqpPubSubconfig'
        google:
          $ref: '#/components/schemas/models.GooglePubSubConfig'
        kafka:
          $ref: '#/components/schemas/models.KafkaPubSubConfig'
        sqs:
          $ref: '#/components/schemas/models.SQSPubSubConfig'
        type:
          $ref: '#/components/schemas/datastore.PubSubType'
        workers:
          type: integer
      type: object
    datastore.SourceType:
      enum:
        - http
        - rest_api
        - pub_sub
        - db_change_stream
      type: string
      x-enum-varnames:
        - HTTPSource
        - RestApiSource
        - PubSubSource
        - DBChangeStream
    models.VerifierConfig:
      properties:
        api_key:
          $ref: '#/components/schemas/models.ApiKey'
        basic_auth:
          $ref: '#/components/schemas/models.BasicAuth'
        hmac:
          $ref: '#/components/schemas/models.HMac'
        type:
          $ref: '#/components/schemas/datastore.VerifierType'
      required:
        - type
      type: object
    datastore.CustomResponse:
      properties:
        body:
          type: string
        content_type:
          type: string
      type: object
    datastore.ProviderConfig:
      properties:
        twitter:
          $ref: '#/components/schemas/datastore.TwitterProviderConfig'
      type: object
    datastore.PubSubConfig:
      properties:
        amqp:
          $ref: '#/components/schemas/datastore.AmqpPubSubConfig'
        google:
          $ref: '#/components/schemas/datastore.GooglePubSubConfig'
        kafka:
          $ref: '#/components/schemas/datastore.KafkaPubSubConfig'
        sqs:
          $ref: '#/components/schemas/datastore.SQSPubSubConfig'
        type:
          $ref: '#/components/schemas/datastore.PubSubType'
        workers:
          type: integer
      type: object
    datastore.VerifierConfig:
      properties:
        api_key:
          $ref: '#/components/schemas/datastore.ApiKey'
        basic_auth:
          $ref: '#/components/schemas/datastore.BasicAuth'
        hmac:
          $ref: '#/components/schemas/datastore.HMac'
        type:
          $ref: '#/components/schemas/datastore.VerifierType'
      type: object
    models.AmqpPubSubconfig:
      properties:
        host:
          type: string
        auth:
          $ref: '#/components/schemas/models.AmqpAuth'
        bindExchange:
          $ref: '#/components/schemas/models.AmqpExchange'
        deadLetterExchange:
          type: string
        port:
          type: string
        queue:
          type: string
        schema:
          type: string
        vhost:
          type: string
      type: object
    models.GooglePubSubConfig:
      properties:
        project_id:
          type: string
        service_account:
          items:
            type: integer
          type: array
        subscription_id:
          type: string
      type: object
    models.KafkaPubSubConfig:
      properties:
        auth:
          $ref: '#/components/schemas/models.KafkaAuth'
        brokers:
          items:
            type: string
          type: array
        consumer_group_id:
          type: string
        topic_name:
          type: string
      type: object
    models.SQSPubSubConfig:
      properties:
        access_key_id:
          type: string
        default_region:
          type: string
        queue_name:
          type: string
        secret_key:
          type: string
      type: object
    datastore.PubSubType:
      enum:
        - sqs
        - google
        - kafka
        - amqp
      type: string
      x-enum-varnames:
        - SqsPubSub
        - GooglePubSub
        - KafkaPubSub
        - AmqpPubSub
    models.ApiKey:
      properties:
        header_name:
          type: string
        header_value:
          type: string
      required:
        - header_name
        - header_value
      type: object
    models.BasicAuth:
      properties:
        password:
          type: string
        username:
          type: string
      required:
        - password
        - username
      type: object
    models.HMac:
      properties:
        encoding:
          $ref: '#/components/schemas/datastore.EncodingType'
        hash:
          type: string
        header:
          type: string
        secret:
          type: string
      required:
        - encoding
        - hash
        - header
        - secret
      type: object
    datastore.VerifierType:
      enum:
        - noop
        - hmac
        - basic_auth
        - api_key
      type: string
      x-enum-varnames:
        - NoopVerifier
        - HMacVerifier
        - BasicAuthVerifier
        - APIKeyVerifier
    datastore.TwitterProviderConfig:
      properties:
        crc_verified_at:
          type: string
      type: object
    datastore.AmqpPubSubConfig:
      properties:
        host:
          type: string
        auth:
          $ref: '#/components/schemas/datastore.AmqpCredentials'
        bindedExchange:
          type: string
        deadLetterExchange:
          type: string
        port:
          type: string
        queue:
          type: string
        routingKey:
          type: string
        schema:
          type: string
        vhost:
          type: string
      type: object
    datastore.GooglePubSubConfig:
      properties:
        project_id:
          type: string
        service_account:
          items:
            type: integer
          type: array
        subscription_id:
          type: string
      type: object
    datastore.KafkaPubSubConfig:
      properties:
        auth:
          $ref: '#/components/schemas/datastore.KafkaAuth'
        brokers:
          items:
            type: string
          type: array
        consumer_group_id:
          type: string
        topic_name:
          type: string
      type: object
    datastore.SQSPubSubConfig:
      properties:
        access_key_id:
          type: string
        default_region:
          type: string
        endpoint:
          description: 'Optional: for LocalStack testing'
          type: string
        queue_name:
          type: string
        secret_key:
          type: string
      type: object
    datastore.ApiKey:
      properties:
        header_name:
          type: string
        header_value:
          type: string
      type: object
    datastore.BasicAuth:
      properties:
        password:
          type: string
        username:
          type: string
      type: object
    datastore.HMac:
      properties:
        encoding:
          $ref: '#/components/schemas/datastore.EncodingType'
        hash:
          type: string
        header:
          type: string
        secret:
          type: string
      type: object
    models.AmqpAuth:
      properties:
        password:
          type: string
        user:
          type: string
      type: object
    models.AmqpExchange:
      properties:
        exchange:
          type: string
        routingKey:
          type: string
      type: object
    models.KafkaAuth:
      properties:
        hash:
          type: string
        password:
          type: string
        tls:
          type: boolean
        type:
          type: string
        username:
          type: string
      type: object
    datastore.EncodingType:
      enum:
        - base64
        - hex
      type: string
      x-enum-varnames:
        - Base64Encoding
        - HexEncoding
    datastore.AmqpCredentials:
      properties:
        password:
          type: string
        user:
          type: string
      type: object
    datastore.KafkaAuth:
      properties:
        hash:
          type: string
        password:
          type: string
        tls:
          type: boolean
        type:
          type: string
        username:
          type: string
      type: object
  securitySchemes:
    ApiKeyAuth:
      in: header
      name: Authorization
      type: apiKey

````