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

# Make a document type

> Makes a document type of the firm's own, with a key made from the label (firm_ and a slug). From now on the reader sorts files into it, told the description. holds is values (read into its fields) or file (kept as a file, no fields). Fields take the shape of add_document_type_field; each may name fact_key, or new_fact to make a client fact in the same step. read_document_id reads that document again as the new type once it is made. sort_unplaced_since_days sorts again the firm's documents the reader could not place in that many days (count_unplaced_documents says how many); the answer says how many were queued. suggestion_id deletes the suggestion it was made from. The name must differ from every type the firm has. The label and description are refused like a field's. A label or instruction that asks for a tax file number, an identity document number, a government reference number or medical details is refused (value_never_kept). Only an admin can call this.



## OpenAPI

````yaml /openapi/advisor.json post /document_types
openapi: 3.1.0
info:
  title: Redbark Advisor API
  version: 2.0.0
  description: >-
    Read and write access to one advice firm in Redbark Advisor: clients,
    checklists, documents, money, messages, reports, team and webhooks. Send an
    API key or a connected app’s access token as a bearer token. A credential
    carries scopes, one read and one write per area, and each call says the
    scope it needs. A write scope brings its read scope. Each key may make 120
    requests a minute.
servers:
  - url: https://advisor.redbark.com/api/v1
security:
  - bearerAuth: []
tags:
  - name: Firm
    description: The firm, its name and its branding.
  - name: Team
    description: Team members and their roles.
  - name: Clients
    description: Clients, their people and portal invites.
  - name: Checklists
    description: Checklist templates, the checklists sent to clients and their answers.
  - name: Documents
    description: Documents clients upload and the details read from them.
  - name: Money
    description: Bank connections, accounts, balances and transactions.
  - name: Document types
    description: Document types, their fields and the client facts they fill.
  - name: Messages
    description: Messages between the firm and clients.
  - name: Reports
    description: Reports exported for clients.
  - name: Webhooks
    description: Webhook endpoints and their deliveries.
  - name: Webhook events
    description: Events sent to your webhook endpoints.
paths:
  /document_types:
    post:
      tags:
        - Document types
      summary: Make a document type
      description: >-
        Makes a document type of the firm's own, with a key made from the label
        (firm_ and a slug). From now on the reader sorts files into it, told the
        description. holds is values (read into its fields) or file (kept as a
        file, no fields). Fields take the shape of add_document_type_field; each
        may name fact_key, or new_fact to make a client fact in the same step.
        read_document_id reads that document again as the new type once it is
        made. sort_unplaced_since_days sorts again the firm's documents the
        reader could not place in that many days (count_unplaced_documents says
        how many); the answer says how many were queued. suggestion_id deletes
        the suggestion it was made from. The name must differ from every type
        the firm has. The label and description are refused like a field's. A
        label or instruction that asks for a tax file number, an identity
        document number, a government reference number or medical details is
        refused (value_never_kept). Only an admin can call this.
      operationId: create_document_type
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                label:
                  type: string
                  minLength: 1
                  maxLength: 80
                description:
                  type: string
                  minLength: 1
                  maxLength: 300
                  description: >-
                    What kind of document it is, in a sentence or two. The
                    reader is told this when it sorts a file, so say how to
                    recognise one.
                group:
                  type: string
                  enum:
                    - banking
                    - income
                    - investments
                    - property
                    - structure
                    - other
                  description: >-
                    The heading it is picked under: banking (Banking and loans),
                    income (Income and tax), investments (Investments and
                    super), property (Property and insurance), structure
                    (Entities and structure), other (Other).
                holds:
                  type: string
                  enum:
                    - values
                    - file
                  description: >-
                    values: values on the page are read into its fields. file:
                    kept as a file, nothing read. Fixed once made.
                fields:
                  anyOf:
                    - type: array
                      items:
                        type: object
                        properties:
                          label:
                            type: string
                            minLength: 1
                            maxLength: 80
                          instruction:
                            anyOf:
                              - anyOf:
                                  - type: string
                                    maxLength: 300
                                  - type: 'null'
                                description: >-
                                  What the reader is told about the value when
                                  the label is not enough, such as where on the
                                  page it is.
                              - type: 'null'
                          value_type:
                            type: string
                            enum:
                              - text
                              - date
                              - amount
                              - number
                              - percent
                            description: >-
                              text, date (YYYY-MM-DD), amount (dollars), number
                              or percent. A field that fills a fact holds the
                              same type as the fact.
                          required:
                            anyOf:
                              - type: boolean
                              - type: 'null'
                          fact_key:
                            anyOf:
                              - anyOf:
                                  - type: string
                                    maxLength: 64
                                  - type: 'null'
                                description: >-
                                  The client fact an approved value fills: a key
                                  from list_fact_definitions whose type matches,
                                  or null for none.
                              - type: 'null'
                          section:
                            anyOf:
                              - type: string
                                maxLength: 80
                              - type: 'null'
                            description: A section name of your own. Details when left out.
                          new_fact:
                            anyOf:
                              - anyOf:
                                  - type: object
                                    properties:
                                      label:
                                        type: string
                                        minLength: 1
                                        maxLength: 80
                                      single:
                                        type: boolean
                                        description: >-
                                          true when a client holds one value;
                                          false for several.
                                    required:
                                      - label
                                      - single
                                    additionalProperties: true
                                  - type: 'null'
                              - type: 'null'
                            description: >-
                              Makes a client fact of the firm's own for this
                              field to fill, of the field's value type (text,
                              date or amount). Give this or fact_key, not both.
                        required:
                          - label
                          - value_type
                        additionalProperties: true
                      maxItems: 40
                    - type: 'null'
                read_document_id:
                  anyOf:
                    - anyOf:
                        - type: string
                          minLength: 1
                          maxLength: 60
                          description: A document id, from list_documents.
                        - type: 'null'
                    - type: 'null'
                sort_unplaced_since_days:
                  anyOf:
                    - anyOf:
                        - type: integer
                          minimum: 1
                          maximum: 365
                        - type: 'null'
                    - type: 'null'
                  description: 1 to 365.
                suggestion_id:
                  anyOf:
                    - anyOf:
                        - type: string
                          minLength: 1
                          maxLength: 60
                          description: >-
                            The suggestion it was made from, from
                            suggest_document_type.
                        - type: 'null'
                    - type: 'null'
              required:
                - label
                - description
                - group
                - holds
      responses:
        '201':
          description: Created.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DocumentTypeCreated'
        '400':
          description: The request is not valid.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: The API key or access token is missing, wrong, expired or revoked.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '402':
          description: >-
            subscription_required: the firm has no active subscription, so it
            cannot add or invite clients or send checklists.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: >-
            The credential lacks the scope this call needs, the call is for
            admins only, or the member it acts as has left the firm.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: No such resource in this firm.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: >-
            The resource is in a state that does not allow this, such as an
            archived client, or client_limit_reached: the plan’s 20 active
            clients are in use.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '413':
          description: The request body is too large.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: Too many requests. See the Retry-After header.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: Something went wrong on our side. Try again.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - bearerAuth:
            - document_types:write
components:
  schemas:
    DocumentTypeCreated:
      type: object
      properties:
        object:
          type: string
          enum:
            - document_type
        id:
          anyOf:
            - type: string
            - type: 'null'
          description: Null for a built-in type.
        key:
          type: string
          description: >-
            Such as payslip or super_statement, or firm_ and a slug for the
            firm's own.
        label:
          type: string
        description:
          type: string
        group:
          type: string
          enum:
            - banking
            - income
            - investments
            - property
            - structure
            - other
          description: >-
            The heading it is picked under: banking (Banking and loans), income
            (Income and tax), investments (Investments and super), property
            (Property and insurance), structure (Entities and structure), other
            (Other).
        origin:
          type: string
          enum:
            - redbark
            - firm
          description: >-
            redbark for Redbark's own, which cannot be changed; firm for the
            firm's own.
        holds:
          type: string
          enum:
            - values
            - file
          description: >-
            values: values on the page are read into its fields. file: kept as a
            file, nothing read. Fixed once made.
        archived:
          type: boolean
          description: >-
            A firm type no longer sorted into or offered. Documents already read
            as it keep it.
        field_count:
          type: number
          description: >-
            Fields read from new documents: built-in and the firm’s, archived
            ones left out.
        fact_keys:
          type: array
          items:
            type: string
          description: The client facts its fields fill.
        read_last_30_days:
          type: number
          description: Documents of this type read in the last 30 days.
        sections:
          type: array
          items:
            type: object
            properties:
              label:
                type: string
              fields:
                type: array
                items:
                  $ref: '#/components/schemas/DocumentTypeField'
            required:
              - label
              - fields
            additionalProperties: true
        read_document:
          anyOf:
            - type: object
              properties:
                document_id:
                  type: string
                started:
                  type: boolean
                message:
                  anyOf:
                    - type: string
                    - type: 'null'
                  description: Why it was not read again, when it was not.
              required:
                - document_id
                - started
                - message
              additionalProperties: true
            - type: 'null'
          description: The document read again as the new type, when one was named.
        unplaced_queued:
          anyOf:
            - type: number
            - type: 'null'
          description: >-
            How many unplaced documents were queued to be sorted again, when
            sort_unplaced_since_days was given.
      required:
        - object
        - id
        - key
        - label
        - description
        - group
        - origin
        - holds
        - archived
        - field_count
        - fact_keys
        - read_last_30_days
        - sections
        - read_document
        - unplaced_queued
      additionalProperties: true
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            type:
              type: string
              enum:
                - invalid_request_error
                - authentication_error
                - permission_error
                - rate_limit_error
                - api_error
            code:
              type: string
            message:
              type: string
            param:
              anyOf:
                - type: string
                - type: 'null'
            request_id:
              type: string
          required:
            - type
            - code
            - message
            - param
            - request_id
          additionalProperties: true
      required:
        - error
      additionalProperties: true
    DocumentTypeField:
      type: object
      properties:
        object:
          type: string
          enum:
            - document_type_field
        id:
          anyOf:
            - type: string
            - type: 'null'
          description: Null for a built-in field.
        key:
          type: string
        label:
          type: string
        type:
          type: string
          enum:
            - text
            - date
            - amount
            - number
            - percent
          description: >-
            text, date (YYYY-MM-DD), amount (dollars), number or percent. A
            field that fills a fact holds the same type as the fact.
        section:
          type: string
        required:
          type: boolean
        instruction:
          anyOf:
            - type: string
            - type: 'null'
          description: What the reader is told. Only the firm's own fields show theirs.
        origin:
          type: string
          enum:
            - redbark
            - firm
          description: >-
            redbark for Redbark's own, which cannot be changed; firm for the
            firm's own.
        archived:
          type: boolean
          description: >-
            No longer read from new documents. Values already read stay and
            still show.
        fact_key:
          anyOf:
            - type: string
            - type: 'null'
          description: The client fact an approved value fills, or null.
      required:
        - object
        - id
        - key
        - label
        - type
        - section
        - required
        - instruction
        - origin
        - archived
        - fact_key
      additionalProperties: true
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        A firm API key, shown once when it is made, or a connected app’s OAuth
        access token. Each operation lists the scope it needs, such as
        clients:write.

````

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