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

# Create vendor

> Create a new vendor within a business.



## OpenAPI

````yaml POST /v1/platform/businesses/{business_id}/vendors/
openapi: 3.0.3
info:
  title: Thredfi Accounting Platform API
  version: 1.0.0
  description: >-
    Comprehensive API for accounting, invoice management, open banking, and
    intelligence services.
servers: []
security: []
paths:
  /v1/platform/businesses/{business_id}/vendors/:
    post:
      tags:
        - Vendors
      summary: Create vendor
      description: Create a new vendor within a business.
      operationId: create_vendor
      parameters:
        - in: path
          name: business_id
          schema:
            type: string
            pattern: ^[0-9a-f-]+$
          required: true
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateVendorRequest'
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/CreateVendorRequest'
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/CreateVendorRequest'
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Vendor'
          description: ''
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationErrorResponse'
          description: Validation errors in request data
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Authentication required - missing or invalid API key
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Permission denied - insufficient privileges
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Resource not found
        '409':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Conflict - resource already exists or invalid state transition
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Unprocessable entity - business logic validation failed
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Internal server error
      security:
        - PartnerJWT: []
        - BusinessScopedJWT: []
        - BasicAuth: []
        - BearerUnscoped: []
        - BearerBusinessScoped: []
components:
  schemas:
    CreateVendorRequest:
      type: object
      description: Input serializer for creating a vendor
      properties:
        external_id:
          type: string
          description: Your unique identifier for this vendor (used for idempotency)
        individual_name:
          type: string
          description: Vendor individual name (required if company_name not provided)
        company_name:
          type: string
          description: Registered company name (required if individual_name not provided)
        email:
          type: string
          format: email
          description: Primary email address for vendor communications
        mobile_phone:
          type: string
          description: >-
            Mobile phone number (E.164 format recommended, e.g., +44 7700
            900123)
        office_phone:
          type: string
          description: >-
            Office phone number (E.164 format recommended, e.g., +44 20 7946
            0958)
        address_string:
          type: string
          description: Vendor mailing address (single string)
        memo:
          type: string
          description: Internal notes or description for this vendor
        transaction_tags:
          type: array
          items: {}
          description: List of tags for categorization
        country:
          type: string
          description: Two-letter country code (ISO 3166-1 alpha-2, e.g., NL, DE, US)
          maxLength: 2
        vat_number:
          type: string
          description: VAT/Tax registration number (e.g., NL123456789B01 for Netherlands)
        document:
          allOf:
            - $ref: '#/components/schemas/VendorDocumentUploadRequest'
          writeOnly: true
          description: Optional document upload
    Vendor:
      type: object
      description: Serializer for vendor objects returned by the vendors list endpoint
      properties:
        type:
          type: string
          readOnly: true
          description: Resource type (always 'VendorData')
        id:
          type: string
          format: uuid
          readOnly: true
          description: Unique vendor identifier
        external_id:
          type: string
          description: Your unique identifier for this vendor (used for idempotency)
          maxLength: 255
        individual_name:
          type: string
          description: Vendor individual name (for sole traders/freelancers)
          maxLength: 255
        company_name:
          type: string
          description: Registered company name (for limited companies)
          maxLength: 255
        email:
          type: string
          format: email
          description: Primary email address for vendor communications
          maxLength: 254
        mobile_phone:
          type: string
          readOnly: true
          description: Mobile phone number (E.164 format, e.g., +44 7700 900123)
        office_phone:
          type: string
          readOnly: true
          description: Office phone number (E.164 format, e.g., +44 20 7946 0958)
        address_string:
          type: string
          readOnly: true
          description: Full formatted address (read-only, auto-generated)
        memo:
          type: string
          readOnly: true
          description: Internal notes or description for this vendor
        status:
          type: string
          readOnly: true
          description: Vendor status (ACTIVE, INACTIVE, ARCHIVED, BLOCKED)
        transaction_tags:
          type: array
          items: {}
          readOnly: true
          description: List of tags for categorization
        documents:
          type: array
          items:
            $ref: '#/components/schemas/DocumentFileUrl'
          readOnly: true
          description: All documents linked to this vendor with presigned URLs
      required:
        - address_string
        - documents
        - id
        - memo
        - mobile_phone
        - office_phone
        - status
        - transaction_tags
        - type
    ValidationErrorResponse:
      type: object
      description: Validation error response with field-specific errors
      properties:
        error_code:
          type: string
          description: Error code (e.g., 'validation_error')
        message:
          type: string
          nullable: true
          description: Human-readable error message
        detail:
          type: object
          additionalProperties: {}
          description: Contains field_errors and additional context
        request_id:
          type: string
          description: Request ID for tracing
      required:
        - detail
        - error_code
        - message
    ErrorResponse:
      type: object
      description: Standard error response format
      properties:
        error_code:
          type: string
          description: Error code for programmatic handling
        message:
          type: string
          nullable: true
          description: Human-readable error message
        detail:
          type: object
          additionalProperties: {}
          description: Additional error details including field_errors and debug info
        request_id:
          type: string
          description: Request ID for tracing
      required:
        - error_code
        - message
    VendorDocumentUploadRequest:
      type: object
      description: Vendor specific document upload payload.
      properties:
        file:
          type: string
          format: binary
          writeOnly: true
        document_type:
          type: string
          default: vendor_document
        upload_source:
          type: string
        metadata: {}
        tags: {}
    DocumentFileUrl:
      type: object
      description: Serializer for document file URL with metadata.
      properties:
        url:
          type: string
          format: uri
          description: Presigned URL for document download
        expires_in:
          type: integer
          description: Seconds until URL expires
        document_id:
          type: string
          format: uuid
          description: Document UUID
        file_name:
          type: string
          description: Original document filename
        file_size:
          type: integer
          description: File size in bytes
        mime_type:
          type: string
          description: MIME type of the document
      required:
        - document_id
        - expires_in
        - file_name
        - file_size
        - mime_type
        - url
  securitySchemes:
    PartnerJWT:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        Partner-level JWT token (unscoped). Token payload includes `partner_id`.
        Business access is validated via partner ownership. Format: `Bearer
        <your-jwt-token>`


        **Use this for**: Multi-business operations where the business_id is
        specified in the URL and partner has access to multiple businesses.
    BusinessScopedJWT:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        Business-scoped JWT token. Token payload includes `business_id` to
        automatically scope requests. Format: `Bearer <your-jwt-token>`


        **Use this for**: Business-specific operations where the business
        context is embedded in the token.
    BasicAuth:
      type: http
      scheme: basic
      description: >-
        Basic authentication for OAuth2 token endpoint. Use partner_uuid:api_key
        as username:password. Example: Authorization: Basic
        base64(partner_uuid:api_key)
    BearerUnscoped:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        Partner (unscoped) JWT Bearer token. Obtain via POST
        /v1/platform/oauth2/token with Basic auth (partner_uuid:api_key). Use
        header: Authorization: Bearer {access_token}
    BearerBusinessScoped:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        Business-scoped JWT Bearer token. Obtain via POST
        /v1/platform/{business_id}/oauth2/token/ using a partner Bearer token.
        Only valid for endpoints whose URL contains that business_id.

````