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

# Create source

> Create a new source



## OpenAPI

````yaml post /v2/sources
openapi: 3.1.0
info:
  title: The Portable API
  description: This API allows you to interact with the Portable platform.
  version: 0.0.1
servers:
  - url: https://api.portable.io
security:
  - bearerAuth: []
paths:
  /v2/sources:
    post:
      tags:
        - Sources
      summary: Create source
      description: Create a new source
      operationId: createSource
      requestBody:
        description: Source to create
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                displayName:
                  type: string
                  description: A human-readable name for the source
                  x-order: 1
                sourceSpec:
                  type: string
                  description: The name of the source spec to create a source for
                  x-order: 2
                properties:
                  $ref: '#/components/schemas/PropertyInput'
                  x-order: 3
              required:
                - sourceSpec
            example:
              sourceSpec: google_calendar
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                type: object
                required:
                  - data
                properties:
                  data:
                    $ref: '#/components/schemas/Source'
              example:
                data:
                  id: 80190
                  displayName: John Doe's Google Calendar
                  sourceSpec: google_calendar
                  properties:
                    - name: email
                      displayName: Email
                      type: string
                      required: true
                      description: Email of the calendar's user
                      value: ''
                  createdAt: 2023‐06‐12T20:03:00Z
                  updatedAt: '2023-08-01T00:00:00Z'
        '400':
          $ref: '#/components/responses/BadRequestError'
        '401':
          $ref: '#/components/responses/UnauthorizedError'
        '403':
          $ref: '#/components/responses/ForbiddenError'
components:
  schemas:
    PropertyInput:
      type: object
      additionalProperties:
        type: string
        x-go-type: any
    Source:
      type: object
      required:
        - id
        - sourceSpec
      properties:
        id:
          type: integer
          format: int
          readOnly: true
          x-go-type-skip-optional-pointer: true
          x-order: 1
        displayName:
          type: string
          description: A human-readable name for the source
          x-go-type-skip-optional-pointer: true
          x-order: 2
        sourceSpec:
          $ref: '#/components/schemas/SourceSpec'
          x-order: 3
        properties:
          $ref: '#/components/schemas/PropertyInput'
          description: >
            The properties of the source. This is a map of property names to
            their values. The names are defined in the `propertyDefinitions`
            field of the source spec.
          x-order: 4
        createdAt:
          type: string
          format: date-time
          readOnly: true
          description: The timestamp marking when the source was created
          x-go-type-skip-optional-pointer: true
          x-order: 5
        updatedAt:
          type: string
          format: date-time
          readOnly: true
          description: The timestamp marking when the source was last updated
          x-go-type-skip-optional-pointer: true
          x-order: 6
      examples:
        - $ref: '#/components/examples/sourceGcal/value'
        - $ref: '#/components/examples/sourceFreshsales/value'
        - $ref: '#/components/examples/sourceWithNoProperties/value'
    SourceSpec:
      allOf:
        - $ref: '#/components/schemas/SourceSpecSummary'
        - type: object
          properties:
            instructions:
              type: string
              readOnly: true
              x-go-type-skip-optional-pointer: true
              x-order: 7
            propertyDefinitions:
              type: array
              items:
                $ref: '#/components/schemas/PropertyDefinition'
              readOnly: true
              x-go-type-skip-optional-pointer: true
              x-go-type: '[]*native.PropDef'
              x-order: 8
      examples:
        - $ref: '#/components/examples/sourceSpecGcal/value'
        - $ref: '#/components/examples/sourceSpecFreshsales/value'
    SourceSpecSummary:
      type: object
      properties:
        name:
          type: string
          readOnly: true
          x-go-type-skip-optional-pointer: true
          x-order: 1
        displayName:
          type: string
          readOnly: true
          x-go-type-skip-optional-pointer: true
          x-order: 2
        website:
          type: string
          format: uri
          readOnly: true
          x-go-type-skip-optional-pointer: true
          x-order: 3
        tagLine:
          type: string
          readOnly: true
          x-go-type-skip-optional-pointer: true
          x-order: 4
        lifecycle:
          type: string
          enum:
            - ALPHA
            - BETA
            - STABLE
            - DEPRECATED
          readOnly: true
          x-go-type-skip-optional-pointer: true
          x-order: 5
        authenticationStrategy:
          type: string
          enum:
            - NONE
            - BASIC
            - TOKEN
            - AUTH_CODE
            - CLIENT_CREDENTIALS
            - FETCH_CREDENTIALS
            - OIDC
          readOnly: true
          x-go-type-skip-optional-pointer: true
          x-order: 6
    PropertyDefinition:
      type: object
      required:
        - name
        - type
        - required
      x-go-type-import:
        path: github.com/portable-io/portable/model/native
      x-go-type: native.PropDef
      properties:
        name:
          type: string
          description: A machine-readable name for the property
          x-order: 1
        displayName:
          type: string
          description: A human-readable name for the property
          x-go-type-skip-optional-pointer: true
          x-order: 2
        type:
          type: string
          description: The type of the property
          x-order: 3
          enum:
            - STRING
            - PASSWORD
            - TEXT
            - NUMBER
            - BOOLEAN
            - DATE
            - DATETIME
            - TIME
        required:
          type: boolean
          description: Whether the property's value is required
          x-order: 4
        description:
          type: string
          description: A human-readable description of the property
          x-go-type-skip-optional-pointer: true
          x-order: 5
  responses:
    BadRequestError:
      description: Bad Request - The request is malformed.
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
            examples:
              - message: Bad Request
    UnauthorizedError:
      description: Unauthorized - No valid API key provided.
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
            examples:
              - message: Unauthorized
    ForbiddenError:
      description: Forbidden - You don't have enough permissions to access this resource.
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
            examples:
              - message: Your current plan does not support this feature
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````