Skip to content

YAML Configuration

This page documents the YAML configuration syntax and options for the ParseMyFile API.

Basic Structure

A YAML configuration file is structured as follows:

yaml
schemas:
  data: 
    type: object
    properties:
      field_name:
        type: string
        description: field description

Explanation

The file always starts with the schemas section followed by data which must be of type object. This defines the essential structure of the document.

Then, in properties, we define the fields we want to extract from the file.

Each property must have a type and a description

Basic Structure

yaml
schemas:
  data:
    type: object
    properties:
      field_name:
        type: string
        description: explanation of how to retrieve this information

Supported Data Types

Basic Types

TypeDescriptionExample
stringFree text"John Doe"
doubleDecimal number123.45
integerInteger42
dateDate (default YYYY-MM-DD)2025-09-10
objectStructured object{ "name": "John", "age": 30 }
array<object>Array of objects[{ "product": "Book", "price": 15.99 }]

Field Examples

Simple Text Field

yaml
schemas:
  data:
    type: object
    properties:
      name:
        type: string
        description: client name

Numeric Field

yaml
schemas:
  data:
    type: object
    properties:
      amount:
        type: double
        description: total amount in euros
      quantity:
        type: integer
        description: quantity

Date Field

yaml
schemas:
  data:
    type: object
    properties:
      invoice_date:
        type: string
        description: invoice issue date (format YYYY-MM-DD)

Array of Objects

yaml
schemas:
  data:
    type: object
    properties:
      products:
        type: array<object>
        description: product list
        items:
          type: object
          properties:
            name:
              type: string
              description: product name
            price:
              type: double
              description: product price

Complete Examples

Invoice Configuration

yaml
schemas:
  data:
    type: object
    properties:
      invoice_number:
        type: string
        description: invoice number
      invoice_date:
        type: string
        description: issue date (format YYYY-MM-DD)
      client_name:
        type: string
        description: client name
      client_address:
        type: string
        description: client address
      total_amount:
        type: double
        description: total amount including tax in euros
      vat_rate:
        type: double
        description: VAT rate in percentage

Form Configuration

yaml
schemas:
  data:
    type: object
    properties:
      form_title:
        type: string
        description: form title
      last_name:
        type: string
        description: family name
      first_name:
        type: string
        description: first name
      email:
        type: string
        description: email address
      phone:
        type: string
        description: phone number
      street:
        type: string
        description: street number and name
      postal_code:
        type: string
        description: postal code
      city:
        type: string
        description: city
      country:
        type: string
        description: country

Contract Configuration

yaml
schemas:
  data:
    type: object
    properties:
      contract_title:
        type: string
        description: contract title
      contracting_parties:
        type: string
        description: contracting parties names
      start_date:
        type: string
        description: contract start date (format YYYY-MM-DD)
      end_date:
        type: string
        description: contract end date (format YYYY-MM-DD)
      amount:
        type: double
        description: contract amount in euros

Best Practices

1. Field Naming

  • Use descriptive and consistent names
  • Avoid special characters and spaces
  • Use snake_case for field names

2. Data Types

  • Use string for free text
  • Use double for amounts and decimal numbers
  • Use integer for quantities and whole numbers
  • Use date for dates
  • Use array<object> for structured lists

3. Descriptions

  • Add clear descriptions for each field
  • Indicate expected formats (e.g., YYYY-MM-DD format for dates)
  • Specify units when necessary (e.g., "in euros")

4. Structure

  • Organize fields logically
  • Use nested objects for related data
  • Group similar fields

Configuration Validation

Before using your YAML configuration, check:

  1. YAML Syntax: Validate syntax with a YAML parser
  2. Structure: Verify that the file starts with schemas: then data:
  3. Valid Types: Ensure the types used are supported
  4. Descriptions: Check that each field has a clear description
  5. Consistency: Ensure the structure matches expected data

ParseMyFile API Documentation