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

# Create an endpoint



## OpenAPI

````yaml POST /apps/connect/v1/endpoints
openapi: 3.1.0
info:
  title: Invopop Connect configuration API
  version: 1.0.0
  description: >-
    Configure how Connect receives and imports a workspace's invoices: rules
    (short instructions for the AI that reads PDFs and images), profiles
    (ordered groups of rules a workflow's import step uses) and endpoints (HTTP
    upload URLs and email addresses that receive documents). Documents give what
    an import recorded for a silo entry.


    Call it through Invopop's API at https://api.invopop.com/apps/connect with a
    workspace token: `Authorization: Bearer <token>`. The workspace must have
    the Connect app enabled.


    Typical setup:

    1. Create rules: `POST /v1/rules {"text": "Use the de-xrechnung-v3 addon"}`.
    Each gets a `number`.

    2. Create a profile from them: `POST /v1/profiles {"name": "Germany",
    "rules": [1, 2]}`, and keep its `id`.

    3. In the workflow's "Import document" step, choose that profile (its config
    is `{"profile_id": "<id>"}`).

    4. Create an endpoint that runs the workflow: `POST /v1/endpoints
    {"channel": "http", "slug": "suppliers", "workflow_id": "<workflow id>",
    "config": {"security": {"type": "bearer", "token": "<secret>"}}}`. Send
    documents to its `uri`.


    Errors answer `{"status": "error", "message": "..."}`: 401 bad token or
    Connect not enabled, 404 not found, 422 invalid request (the message says
    which field and why).
  contact:
    email: dev@invopop.com
    name: Invopop Developers
servers:
  - description: production
    url: https://api.invopop.com
security:
  - InvopopAuth: []
paths:
  /apps/connect/v1/endpoints:
    post:
      summary: Create an endpoint
      operationId: createEndpoint
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/EndpointCreate'
      responses:
        '201':
          description: The new endpoint
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Endpoint'
        '422':
          $ref: '#/components/responses/Error'
components:
  schemas:
    EndpointCreate:
      description: >-
        An endpoint as created: like EndpointInput, with the credentials its
        security or provider needs, which an update can leave out to keep the
        stored ones.
      allOf:
        - $ref: '#/components/schemas/EndpointInput'
        - if:
            required:
              - channel
            properties:
              channel:
                const: http
          then:
            properties:
              config:
                properties:
                  security:
                    allOf:
                      - if:
                          properties:
                            type:
                              const: bearer
                        then:
                          required:
                            - token
                      - if:
                          properties:
                            type:
                              const: basic
                        then:
                          required:
                            - user
                            - pass
                      - if:
                          properties:
                            type:
                              const: hmac
                        then:
                          required:
                            - secret
        - if:
            required:
              - channel
            properties:
              channel:
                const: email
          then:
            properties:
              config:
                allOf:
                  - if:
                      properties:
                        provider:
                          const: imap
                    then:
                      properties:
                        imap:
                          required:
                            - password
                  - if:
                      properties:
                        provider:
                          const: resend
                    then:
                      properties:
                        resend:
                          required:
                            - api_key
                  - if:
                      properties:
                        provider:
                          const: sendgrid
                    then:
                      properties:
                        sendgrid:
                          required:
                            - api_key
    Endpoint:
      type: object
      properties:
        id:
          type: string
        slug:
          type: string
        channel:
          type: string
          enum:
            - http
            - email
        workflow_id:
          type: string
        uri:
          type: string
          description: >-
            Where senders reach the endpoint: the URL to POST documents to
            (http), or the address documents are sent to (email)
        accept:
          type: array
          items:
            type: string
        disabled:
          type: boolean
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
        config:
          description: The channel's config as given, without secrets
          anyOf:
            - $ref: '#/components/schemas/HTTPConfig'
            - $ref: '#/components/schemas/EmailConfig'
    EndpointInput:
      type: object
      required:
        - channel
        - slug
        - workflow_id
      description: A workspace can have up to 20 endpoints.
      properties:
        channel:
          type: string
          enum:
            - http
            - email
          description: >-
            http: documents are POSTed to the endpoint's uri. email: documents
            arrive as email attachments. Each channel has its own config.
        slug:
          type: string
          pattern: ^[a-z0-9]+(?:-[a-z0-9]+)*$
          description: >-
            Unique in the workspace; part of the url, and the default name of an
            Invopop email address
          examples:
            - suppliers
        workflow_id:
          type: string
          description: >-
            The workflow each received invoice runs; it should include Connect's
            "Import document" step
        accept:
          type: array
          items:
            type: string
            enum:
              - application/json
              - application/xml
              - text/xml
              - application/pdf
              - text/csv
              - application/octet-stream
              - image/jpeg
              - image/png
              - image/webp
              - image/tiff
              - image/heic
          description: >-
            Content types accepted; empty accepts any (email: PDF, XML, JSON and
            images)
        disabled:
          type: boolean
          description: Stop receiving without deleting the endpoint
        config:
          description: >-
            The channel's own settings: HTTPConfig for http, EmailConfig for
            email. A secret left out on update keeps the stored one.
      oneOf:
        - title: HTTP endpoint
          properties:
            channel:
              const: http
            config:
              $ref: '#/components/schemas/HTTPConfig'
        - title: Email endpoint
          required:
            - config
          properties:
            channel:
              const: email
            config:
              $ref: '#/components/schemas/EmailConfig'
    HTTPConfig:
      type: object
      description: >-
        The http channel's config: how uploads authenticate. Secrets are stored
        encrypted and never returned.
      properties:
        security:
          type: object
          description: >-
            How an http endpoint authenticates uploads. Secrets are stored
            encrypted and never returned.
          required:
            - type
          properties:
            type:
              type: string
              enum:
                - none
                - bearer
                - basic
                - hmac
              description: >-
                none: anyone with the url. bearer: `Authorization: Bearer
                <token>`. basic: HTTP Basic with user and pass. hmac:
                `X-Signature` holds the hex HMAC-SHA256 of the body keyed with
                secret.
            token:
              type: string
              description: For bearer
            user:
              type: string
              description: For basic
            pass:
              type: string
              description: For basic
            secret:
              type: string
              description: For hmac
    EmailConfig:
      type: object
      description: >-
        The email channel's config: how messages reach the endpoint. Passwords
        and API keys are stored encrypted and never returned.
      required:
        - provider
      properties:
        provider:
          type: string
          enum:
            - invopop
            - imap
            - resend
            - sendgrid
          description: >-
            invopop: an address on Invopop's receiving domain (address is its
            name, before the @; empty uses the slug). imap: Connect reads a
            folder of your mailbox. resend: mail your own Resend account
            receives. sendgrid: mail a hostname of your own SendGrid account
            receives through Inbound Parse.
        address:
          type: string
          description: 'For invopop: the address name'
        imap:
          type: object
          description: For imap
          required:
            - host
            - username
          properties:
            host:
              type: string
            port:
              type: integer
              description: Default 993
            security:
              type: string
              enum:
                - tls
                - starttls
            username:
              type: string
            password:
              type: string
              description: Required when creating; empty on update keeps the stored one
            folder:
              type: string
              description: Default INBOX
            after_read:
              type: string
              enum:
                - none
                - seen
                - move
              description: What to do with a message once read
            move_to:
              type: string
              description: For after_read move
        resend:
          type: object
          description: For resend
          required:
            - recipient
          properties:
            api_key:
              type: string
              description: >-
                A full access key (Connect creates its webhook with it);
                required when creating, left out on update keeps the stored one
            recipient:
              type: string
              description: The address that receives the documents
        sendgrid:
          type: object
          description: For sendgrid
          required:
            - hostname
          properties:
            api_key:
              type: string
              description: >-
                A key allowed to manage Inbound Parse settings (Connect creates
                the setting with it); required when creating, left out on update
                keeps the stored one
            region:
              type: string
              enum:
                - global
                - eu
              description: The account's API region; default global
            hostname:
              type: string
              description: >-
                The hostname that receives the documents; its MX record points
                at mx.sendgrid.net
            recipient:
              type: string
              description: One address on the hostname to take; empty takes every address
        allowed_senders:
          type: array
          items:
            type: string
          description: >-
            Addresses or domains ("supplier.com") allowed to send; empty allows
            anyone
      oneOf:
        - title: Invopop address
          properties:
            provider:
              const: invopop
        - title: IMAP mailbox
          required:
            - imap
          properties:
            provider:
              const: imap
        - title: Resend
          required:
            - resend
          properties:
            provider:
              const: resend
        - title: SendGrid
          required:
            - sendgrid
          properties:
            provider:
              const: sendgrid
  responses:
    Error:
      description: An error
      content:
        application/json:
          schema:
            type: object
            properties:
              status:
                const: error
              message:
                type: string
  securitySchemes:
    InvopopAuth:
      type: http
      scheme: bearer
      description: >-
        A workspace token in the `Bearer` scheme. The workspace must have the
        Connect app enabled.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.