Skip to main content
POST
/
v1
/
documents
Create a document
curl --request POST \
  --url https://api.wellapp.ai/v1/documents \
  --header 'Authorization: <authorization>' \
  --header 'Content-Type: multipart/form-data' \
  --form 'data.type=<string>' \
  --form 'data.attributes.file_name=<string>' \
  --form data.attributes.workspace_id=3c90c3cc-0d44-4b50-8888-8dd25736052a \
  --form data.attributes.external_workspace_id=3c90c3cc-0d44-4b50-8888-8dd25736052a \
  --form data.attributes.collect_id=3c90c3cc-0d44-4b50-8888-8dd25736052a \
  --form 'data.attributes.metadata.source_number=<string>' \
  --form 'data.attributes.metadata.target_number=<string>' \
  --form data.attributes.metadata.document_type=invoice \
  --form 'data.relationships.workspace.data.type=<string>' \
  --form data.relationships.workspace.data.id=3c90c3cc-0d44-4b50-8888-8dd25736052a \
  --form 'data.relationships.company.data.type=<string>' \
  --form data.relationships.company.data.id=3c90c3cc-0d44-4b50-8888-8dd25736052a \
  --form 'data.relationships.people.data.type=<string>' \
  --form data.relationships.people.data.id=3c90c3cc-0d44-4b50-8888-8dd25736052a \
  --form 'data.relationships.people.data.meta.phone_number=<string>' \
  --form file=@example-file
{
  "data": {
    "type": "document",
    "id": "550e8400-e29b-41d4-a716-446655440010",
    "attributes": {
      "file_name": "invoice_2024.pdf",
      "workspace_id": "550e8400-e29b-41d4-a716-446655440001",
      "collect_id": "550e8400-e29b-41d4-a716-446655440002",
      "metadata": {
        "source_number": "+33123456789",
        "target_number": "+33987654321",
        "document_type": "invoice"
      },
      "created_at": "2024-01-20T10:30:00Z",
      "updated_at": "2024-01-20T10:30:00Z"
    },
    "relationships": {
      "workspace": {
        "data": {
          "type": "workspace",
          "id": "550e8400-e29b-41d4-a716-446655440001"
        }
      },
      "company": {
        "data": {
          "type": "company",
          "id": "550e8400-e29b-41d4-a716-446655440003"
        }
      },
      "people": {
        "data": {
          "type": "people",
          "id": "550e8400-e29b-41d4-a716-446655440004",
          "meta": {
            "phone_number": "+33123456789"
          }
        }
      }
    }
  },
  "included": [
    {
      "type": "workspace",
      "id": "550e8400-e29b-41d4-a716-446655440001",
      "attributes": {
        "name": "Sales Team Workspace",
        "description": "Workspace for sales documents and invoices",
        "avatar_color": "#4A90E2",
        "external_workspace_id": "sales_ws_001",
        "auto_extract_enabled": true,
        "created_at": "2024-01-15T09:00:00Z",
        "updated_at": "2024-01-15T09:00:00Z"
      }
    },
    {
      "type": "company",
      "id": "550e8400-e29b-41d4-a716-446655440003",
      "attributes": {
        "name": "ACME Corporation",
        "description": "Leading technology and consulting company",
        "locale": "fr",
        "domain_name_primary_link_url": "acme.com",
        "tax_id": {
          "value": "FR12345678901",
          "type": "VAT"
        },
        "registration": {
          "trade_name": "ACME",
          "registered_name": "ACME Corporation SAS"
        },
        "registration_number": {
          "business_type": "SAS",
          "value": "RCS 123456789",
          "registry_name": "Registre du Commerce Paris",
          "registry_country": "FR"
        },
        "created_at": "2024-01-10T08:00:00Z",
        "updated_at": "2024-01-10T08:00:00Z"
      }
    },
    {
      "type": "people",
      "id": "550e8400-e29b-41d4-a716-446655440004",
      "attributes": {
        "first_name": "Jean",
        "last_name": "Dupont",
        "full_name": "Jean Dupont",
        "created_at": "2024-01-12T10:00:00Z",
        "updated_at": "2024-01-12T10:00:00Z"
      }
    }
  ]
}

Headers

Authorization
string
required

Bearer token for authentication

Body

multipart/form-data
file
file
required

The document file to upload (PDF, image, Word document, etc.)

data.type
string

Resource type identifier

Allowed value: "document"
data.attributes.file_name
string

Name of the document file

Required string length: 1 - 255
data.attributes.workspace_id
string<uuid>

Workspace UUID

data.attributes.external_workspace_id
string<uuid>

External Workspace UUID

data.attributes.collect_id
string<uuid>

Collection UUID (optional)

data.attributes.metadata.source_number
string

Source phone number for the document

data.attributes.metadata.target_number
string

Target phone number for the document

data.attributes.metadata.document_type
enum<string>

Type of document classification. See all document types for complete list.

Available options:
invoice,
receipt,
purchase_order,
...
data.relationships.workspace.data.type
string

Type for workspace relationship

Allowed value: "workspace"
data.relationships.workspace.data.id
string<uuid>

UUID of the workspace to associate with this document

data.relationships.company.data.type
string

Type for company relationship

Allowed value: "company"
data.relationships.company.data.id
string<uuid>

UUID of the company to associate with this document

data.relationships.people.data.type
string

Type for people relationship

Allowed value: "people"
data.relationships.people.data.id
string<uuid>

UUID of the person to associate with this document

data.relationships.people.data.meta.phone_number
string

Phone number to identify the person (alternative to ID)

Response

Document created successfully

id
string
type
enum<string>
Available options:
document
attributes
object
relationships
object
I