# Journey API

- **Base URL:** `https://journey-config.sls.epilot.io`
- **Full API Docs:** [https://docs.epilot.io/api/journey](https://docs.epilot.io/api/journey)

## Usage

```ts
import { epilot } from '@epilot/sdk'

epilot.authorize(() => '<token>')
const { data } = await epilot.journey.getJourneysByOrgId(...)
```

### Tree-shakeable import

```ts
import { getClient, authorize } from '@epilot/sdk/journey'

const journeyClient = getClient()
authorize(journeyClient, () => '<token>')
const { data } = await journeyClient.getJourneysByOrgId(...)
```

## Operations

**Journeys**
- [`getJourneysByOrgId`](#getjourneysbyorgid)
- [`getJourney`](#getjourney)
- [`removeJourney`](#removejourney)
- [`getJourneyProducts`](#getjourneyproducts)
- [`createJourney`](#createjourney)
- [`updateJourney`](#updatejourney)
- [`patchUpdateJourney`](#patchupdatejourney)
- [`searchJourneys`](#searchjourneys)
- [`generateDocument`](#generatedocument)
- [`getSettingsForJourney`](#getsettingsforjourney)
- [`getButtonOptions`](#getbuttonoptions)

**Journeys V2**
- [`createJourneyV2`](#createjourneyv2)
- [`updateJourneyV2`](#updatejourneyv2)
- [`patchUpdateJourneyV2`](#patchupdatejourneyv2)
- [`getJourneyV2`](#getjourneyv2)
- [`removeJourneyV2`](#removejourneyv2)

**Schemas**
- [`GetJourneysResponse`](#getjourneysresponse)
- [`JourneyResponse`](#journeyresponse)
- [`JourneyProductsResponse`](#journeyproductsresponse)
- [`PatchUpdateJourneyRequest`](#patchupdatejourneyrequest)
- [`JourneyCreationRequest`](#journeycreationrequest)
- [`JourneyCreationRequestV2`](#journeycreationrequestv2)
- [`SearchJourneysQueryRequest`](#searchjourneysqueryrequest)
- [`SearchJourneysResponse`](#searchjourneysresponse)
- [`Journey`](#journey)
- [`JourneyFeatureFlags`](#journeyfeatureflags)
- [`JourneyAuditInfo`](#journeyauditinfo)
- [`JourneyValidationResponse`](#journeyvalidationresponse)
- [`JourneyValidationError`](#journeyvalidationerror)
- [`S3Reference`](#s3reference)
- [`TemplateSettings`](#templatesettings)
- [`GenerateDocumentResponse`](#generatedocumentresponse)
- [`GenerateDocumentRequest`](#generatedocumentrequest)
- [`GetSettingsForJourney`](#getsettingsforjourney)
- [`ButtonOption`](#buttonoption)
- [`ValidationRuleRef`](#validationruleref)
- [`RuleRef`](#ruleref)

### `getJourneysByOrgId`

Get all journeys by organization id

`GET /v1/journey/organization/{id}`

```ts
const { data } = await client.getJourneysByOrgId({
  id: '123e4567-e89b-12d3-a456-426614174000',
  hydrate: 'example',
})
```

<details>
<summary>Response</summary>

```json
{}
```

</details>

---

### `getJourney`

Get journey by id. Private journeys requires valid private token to be passed

`GET /v1/journey/configuration/{id}`

```ts
const { data } = await client.getJourney({
  id: '123e4567-e89b-12d3-a456-426614174000',
  source: 'example',
  orgId: 'example',
})
```

<details>
<summary>Response</summary>

```json
{
  "journeyId": "string",
  "organizationId": "string",
  "brandId": "string",
  "name": "string",
  "steps": [
    {
      "showStepName": true,
      "title": "string",
      "subTitle": "string",
      "showStepSubtitle": true,
      "showStepper": true,
      "showStepperLabels": true,
      "hideNextButton": true,
      "name": "string",
      "stepId": "string",
      "schema": {},
      "uischema": {},
      "maxWidth": "small"
    }
  ],
  "design": {
    "logoUrl": "string",
    "theme": {},
    "designTokens": {}
  },
  "rules": [
    {
      "type": "inject",
      "sourceType": "journey",
      "source": "string",
      "target": "string"
    }
  ],
  "logics": [
    {
      "autoGeneratedId": "string",
      "conditions": ["string"],
      "actions": ["string"]
    }
  ],
  "logicsV4": {},
  "contextSchema": [
    {
      "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "type": "string",
      "paramKey": "string",
      "isRequired": true,
      "shouldLoadEntity": true
    }
  ],
  "journey_type": "Sales template (Premium)",
  "protected": true,
  "settings": {
    "embedOptions": {
      "mode": "full-screen",
      "lang": "de",
      "width": "string",
      "topBar": true,
      "scrollToTop": true,
      "button": {}
    },
    "safeModeAutomation": true,
    "canary": true,
    "designId": "string",
    "templateId": "string",
    "entityId": "string",
    "mappingsAutomationId": "string",
    "targetedCustomer": "string",
    "description": "string",
    "organizationSettings": {},
    "publicToken": "string",
    "runtimeEntities": ["ORDER"],
    "filePurposes": ["string"],
    "entityTags": ["string"],
    "addressSuggestionsFileUrl": "string",
    "addressSuggestionsFileId": "string",
    "addressSuggestionsCountryCode": "string",
    "addressSuggestionsEnableAutoComplete": true,
    "addressSuggestionsSource": ["string"],
    "addressSuggestionsEnableFreeText": true,
    "useNewDesign": true,
    "useAustrianLabels": true,
    "enableDarkMode": true,
    "accessMode": "PUBLIC",
    "isPublished": true,
    "status": "string",
    "isActive": true,
    "savingProgress": {
      "savingMode": "auto",
      "supportedVersion": 0
    },
    "thirdPartyCookies": true
  },
  "validationRules": {
    "block1": "rule123",
    "block2": {
      "field1": "rule456",
      "field2": "rule789"
    }
  },
  "createdBy": "string",
  "updatedBy": "string",
  "__lastModifiedAt": "string",
  "createdAt": "string",
  "lastModifiedAt": "string",
  "deletedAt": "string",
  "version": 0,
  "revisions": 0,
  "featureFlags": {}
}
```

</details>

---

### `removeJourney`

Remove journey by id

`DELETE /v1/journey/configuration/{id}`

```ts
const { data } = await client.removeJourney({
  id: '123e4567-e89b-12d3-a456-426614174000',
})
```

---

### `getJourneyProducts`

Get products available in the journey by id. requires public journey token to be passed.

`GET /v1/journey/products/{id}`

```ts
const { data } = await client.getJourneyProducts({
  id: '123e4567-e89b-12d3-a456-426614174000',
  source: 'example',
  postal_code: 'example',
  city: 'example',
  street: 'example',
  street_number: 'example',
})
```

<details>
<summary>Response</summary>

```json
[
  {
    "type": "string",
    "_schema": "string",
    "_title": "string",
    "name": "string",
    "_id": "string",
    "_org": "string",
    "code": "string",
    "description": "string",
    "feature": [
      {}
    ],
    "product_images": [
      {}
    ],
    "legal_footnote": "string",
    "product_downloads": [
      {}
    ],
    "price": {}
  }
]
```

</details>

---

### `createJourney`

Create a Journey

`POST /v1/journey/configuration`

```ts
const { data } = await client.createJourney(
  {
    skipAutomation: 'example',
  },
  {
    journeyId: 'string',
    organizationId: 'string',
    brandId: 'string',
    name: 'string',
    steps: [
      {
        showStepName: true,
        title: 'string',
        subTitle: 'string',
        showStepSubtitle: true,
        showStepper: true,
        showStepperLabels: true,
        hideNextButton: true,
        name: 'string',
        stepId: 'string',
        schema: {},
        uischema: {},
        maxWidth: 'small'
      }
    ],
    design: {
      logoUrl: 'string',
      theme: {},
      designTokens: {}
    },
    rules: [
      {
        type: 'inject',
        sourceType: 'journey',
        source: 'string',
        target: 'string'
      }
    ],
    logics: [
      {
        autoGeneratedId: 'string',
        conditions: ['string'],
        actions: ['string']
      }
    ],
    logicsV4: {},
    contextSchema: [
      {
        id: '3fa85f64-5717-4562-b3fc-2c963f66afa6',
        type: 'string',
        paramKey: 'string',
        isRequired: true,
        shouldLoadEntity: true
      }
    ],
    journey_type: 'Sales template (Premium)',
    protected: true,
    settings: {
      embedOptions: {
        mode: 'full-screen',
        lang: 'de',
        width: 'string',
        topBar: true,
        scrollToTop: true,
        button: { /* ... */ }
      },
      safeModeAutomation: true,
      canary: true,
      designId: 'string',
      templateId: 'string',
      entityId: 'string',
      mappingsAutomationId: 'string',
      targetedCustomer: 'string',
      description: 'string',
      organizationSettings: {},
      publicToken: 'string',
      runtimeEntities: ['ORDER'],
      filePurposes: ['string'],
      entityTags: ['string'],
      addressSuggestionsFileUrl: 'string',
      addressSuggestionsFileId: 'string',
      addressSuggestionsCountryCode: 'string',
      addressSuggestionsEnableAutoComplete: true,
      addressSuggestionsSource: ['string'],
      addressSuggestionsEnableFreeText: true,
      useNewDesign: true,
      useAustrianLabels: true,
      enableDarkMode: true,
      accessMode: 'PUBLIC',
      isPublished: true,
      status: 'string',
      isActive: true,
      savingProgress: {
        savingMode: 'auto',
        supportedVersion: 0
      },
      thirdPartyCookies: true
    },
    validationRules: {
      block1: 'rule123',
      block2: {
        field1: 'rule456',
        field2: 'rule789'
      }
    },
    createdBy: 'string',
    updatedBy: 'string',
    __lastModifiedAt: 'string'
  },
)
```

<details>
<summary>Response</summary>

```json
{
  "journeyId": "string",
  "organizationId": "string",
  "brandId": "string",
  "name": "string",
  "steps": [
    {
      "showStepName": true,
      "title": "string",
      "subTitle": "string",
      "showStepSubtitle": true,
      "showStepper": true,
      "showStepperLabels": true,
      "hideNextButton": true,
      "name": "string",
      "stepId": "string",
      "schema": {},
      "uischema": {},
      "maxWidth": "small"
    }
  ],
  "design": {
    "logoUrl": "string",
    "theme": {},
    "designTokens": {}
  },
  "rules": [
    {
      "type": "inject",
      "sourceType": "journey",
      "source": "string",
      "target": "string"
    }
  ],
  "logics": [
    {
      "autoGeneratedId": "string",
      "conditions": ["string"],
      "actions": ["string"]
    }
  ],
  "logicsV4": {},
  "contextSchema": [
    {
      "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "type": "string",
      "paramKey": "string",
      "isRequired": true,
      "shouldLoadEntity": true
    }
  ],
  "journey_type": "Sales template (Premium)",
  "protected": true,
  "settings": {
    "embedOptions": {
      "mode": "full-screen",
      "lang": "de",
      "width": "string",
      "topBar": true,
      "scrollToTop": true,
      "button": {}
    },
    "safeModeAutomation": true,
    "canary": true,
    "designId": "string",
    "templateId": "string",
    "entityId": "string",
    "mappingsAutomationId": "string",
    "targetedCustomer": "string",
    "description": "string",
    "organizationSettings": {},
    "publicToken": "string",
    "runtimeEntities": ["ORDER"],
    "filePurposes": ["string"],
    "entityTags": ["string"],
    "addressSuggestionsFileUrl": "string",
    "addressSuggestionsFileId": "string",
    "addressSuggestionsCountryCode": "string",
    "addressSuggestionsEnableAutoComplete": true,
    "addressSuggestionsSource": ["string"],
    "addressSuggestionsEnableFreeText": true,
    "useNewDesign": true,
    "useAustrianLabels": true,
    "enableDarkMode": true,
    "accessMode": "PUBLIC",
    "isPublished": true,
    "status": "string",
    "isActive": true,
    "savingProgress": {
      "savingMode": "auto",
      "supportedVersion": 0
    },
    "thirdPartyCookies": true
  },
  "validationRules": {
    "block1": "rule123",
    "block2": {
      "field1": "rule456",
      "field2": "rule789"
    }
  },
  "createdBy": "string",
  "updatedBy": "string",
  "__lastModifiedAt": "string",
  "createdAt": "string",
  "lastModifiedAt": "string",
  "deletedAt": "string",
  "version": 0,
  "revisions": 0,
  "featureFlags": {}
}
```

</details>

---

### `updateJourney`

Update a Journey

`PUT /v1/journey/configuration`

```ts
const { data } = await client.updateJourney(
  null,
  {
    journeyId: 'string',
    organizationId: 'string',
    brandId: 'string',
    name: 'string',
    steps: [
      {
        showStepName: true,
        title: 'string',
        subTitle: 'string',
        showStepSubtitle: true,
        showStepper: true,
        showStepperLabels: true,
        hideNextButton: true,
        name: 'string',
        stepId: 'string',
        schema: {},
        uischema: {},
        maxWidth: 'small'
      }
    ],
    design: {
      logoUrl: 'string',
      theme: {},
      designTokens: {}
    },
    rules: [
      {
        type: 'inject',
        sourceType: 'journey',
        source: 'string',
        target: 'string'
      }
    ],
    logics: [
      {
        autoGeneratedId: 'string',
        conditions: ['string'],
        actions: ['string']
      }
    ],
    logicsV4: {},
    contextSchema: [
      {
        id: '3fa85f64-5717-4562-b3fc-2c963f66afa6',
        type: 'string',
        paramKey: 'string',
        isRequired: true,
        shouldLoadEntity: true
      }
    ],
    journey_type: 'Sales template (Premium)',
    protected: true,
    settings: {
      embedOptions: {
        mode: 'full-screen',
        lang: 'de',
        width: 'string',
        topBar: true,
        scrollToTop: true,
        button: { /* ... */ }
      },
      safeModeAutomation: true,
      canary: true,
      designId: 'string',
      templateId: 'string',
      entityId: 'string',
      mappingsAutomationId: 'string',
      targetedCustomer: 'string',
      description: 'string',
      organizationSettings: {},
      publicToken: 'string',
      runtimeEntities: ['ORDER'],
      filePurposes: ['string'],
      entityTags: ['string'],
      addressSuggestionsFileUrl: 'string',
      addressSuggestionsFileId: 'string',
      addressSuggestionsCountryCode: 'string',
      addressSuggestionsEnableAutoComplete: true,
      addressSuggestionsSource: ['string'],
      addressSuggestionsEnableFreeText: true,
      useNewDesign: true,
      useAustrianLabels: true,
      enableDarkMode: true,
      accessMode: 'PUBLIC',
      isPublished: true,
      status: 'string',
      isActive: true,
      savingProgress: {
        savingMode: 'auto',
        supportedVersion: 0
      },
      thirdPartyCookies: true
    },
    validationRules: {
      block1: 'rule123',
      block2: {
        field1: 'rule456',
        field2: 'rule789'
      }
    },
    createdBy: 'string',
    updatedBy: 'string',
    __lastModifiedAt: 'string'
  },
)
```

---

### `patchUpdateJourney`

Update a Journey (partially / patch). Support for nested properties updates (e.g. "property[0].name").

`PATCH /v1/journey/configuration`

```ts
const { data } = await client.patchUpdateJourney(
  null,
  {
    journeyId: '509cdffe-424f-457a-95c2-9708c304ce77',
    __lastModifiedAt: 'string'
  },
)
```

<details>
<summary>Response</summary>

```json
{
  "createdJourney": {
    "journeyId": "string",
    "organizationId": "string",
    "brandId": "string",
    "name": "string",
    "steps": [
      {}
    ],
    "design": {
      "logoUrl": "string",
      "theme": {},
      "designTokens": {}
    },
    "rules": [
      {}
    ],
    "logics": [
      {}
    ],
    "logicsV4": {},
    "contextSchema": [
      {}
    ],
    "journey_type": "Sales template (Premium)",
    "protected": true,
    "settings": {
      "embedOptions": {},
      "safeModeAutomation": true,
      "canary": true,
      "designId": "string",
      "templateId": "string",
      "entityId": "string",
      "mappingsAutomationId": "string",
      "targetedCustomer": "string",
      "description": "string",
      "organizationSettings": {},
      "publicToken": "string",
      "runtimeEntities": ["ORDER"],
      "filePurposes": ["string"],
      "entityTags": ["string"],
      "addressSuggestionsFileUrl": "string",
      "addressSuggestionsFileId": "string",
      "addressSuggestionsCountryCode": "string",
      "addressSuggestionsEnableAutoComplete": true,
      "addressSuggestionsSource": ["string"],
      "addressSuggestionsEnableFreeText": true,
      "useNewDesign": true,
      "useAustrianLabels": true,
      "enableDarkMode": true,
      "accessMode": "PUBLIC",
      "isPublished": true,
      "status": "string",
      "isActive": true,
      "savingProgress": {},
      "thirdPartyCookies": true
    },
    "validationRules": {
      "block1": "rule123",
      "block2": {}
    },
    "createdBy": "string",
    "updatedBy": "string",
    "__lastModifiedAt": "string",
    "createdAt": "string",
    "lastModifiedAt": "string",
    "deletedAt": "string",
    "version": 0,
    "revisions": 0,
    "featureFlags": {}
  }
}
```

</details>

---

### `searchJourneys`

Search Journeys

`POST /v1/journey/configuration/search`

```ts
const { data } = await client.searchJourneys(
  null,
  {
    q: '_tags:*Flex*',
    from: 0,
    size: 25,
    sort: '_created_at:desc'
  },
)
```

<details>
<summary>Response</summary>

```json
{
  "hits": 1,
  "results": [
    {
      "_id": "e0f8f8f8-f8f8-f8f8-f8f8-f8f8f8f8f8f8",
      "_schema": "journey",
      "_title": "Journey Entity Title",
      "_org": "739224",
      "_created_at": "2020-01-01T00:00:00.000Z",
      "_updated_at": "2020-01-01T00:00:00.000Z",
      "_tags": ["Flex"],
      "_manifest": ["123e4567-e89b-12d3-a456-426614174000"],
      "journey_name": "Journey Name",
      "journey_id": "de7df470-253e-11ed-9174-116b8a718c0a",
      "journey_type": "Sales template",
      "design": "Design EPILOT",
      "created_by": [
        {
          "id": "12345"
        }
      ],
      "journey_version": "Flex"
    }
  ]
}
```

</details>

---

### `generateDocument`

Builds document generated from a template with journey values."

`POST /v1/journey/document:generate`

```ts
const { data } = await client.generateDocument(
  null,
  {
    file_id: '1a2b3c4d-5e6f-7g8h-9i0j-1k2l3m4n5o6p',
    context_data: {
      additionalProperties: 'string'
    },
    language: 'de'
  },
)
```

<details>
<summary>Response</summary>

```json
{
  "job_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "job_status": "STARTED",
  "message": "string",
  "pdf_output": {
    "preview_url": "https://document-api-prod.s3.eu-central-1.amazonaws.com/preview/my-template-OR-001.pdf",
    "output_document": {
      "s3ref": {
        "bucket": "document-api-preview-prod",
        "key": "preview/my-template.pdf"
      }
    }
  },
  "docx_output": {
    "preview_url": "https://document-api-prod.s3.eu-central-1.amazonaws.com/preview/my-template-OR-001.docx",
    "output_document": {
      "s3ref": {
        "bucket": "document-api-preview-prod",
        "key": "preview/my-template.docx"
      }
    }
  },
  "variable_payload": {
    "additionalProperties": "string"
  },
  "template_settings": {
    "custom_margins": {
      "top": 2.54,
      "bottom": 2.54
    },
    "suggested_margins": {
      "top": 2.54,
      "bottom": 2.54
    },
    "display_margin_guidelines": true,
    "enable_data_table_margin_autofix": false,
    "template_with_datatable": false,
    "enabled_template_settings_persistence": false,
    "misconfigured_margins": false,
    "file_entity_id": "1a2b3c4d-5e6f-7a8b-9c0d-1e2f3a4b5c6d"
  }
}
```

</details>

---

### `createJourneyV2`

Create a Journey

`POST /v2/journey/configuration`

```ts
const { data } = await client.createJourneyV2(
  {
    skipAutomation: 'example',
  },
  {
    journeyId: 'string',
    brandId: 'string',
    name: 'string',
    steps: [
      {
        showStepName: true,
        title: 'string',
        subTitle: 'string',
        showStepSubtitle: true,
        showStepper: true,
        showStepperLabels: true,
        hideNextButton: true,
        name: 'string',
        stepId: 'string',
        schema: {},
        uischema: {},
        maxWidth: 'small'
      }
    ],
    design: {
      logoUrl: 'string',
      theme: {},
      designTokens: {}
    },
    rules: [
      {
        type: 'inject',
        sourceType: 'journey',
        source: 'string',
        target: 'string'
      }
    ],
    logics: [
      {
        autoGeneratedId: 'string',
        conditions: ['string'],
        actions: ['string']
      }
    ],
    logicsV4: {},
    contextSchema: [
      {
        id: '3fa85f64-5717-4562-b3fc-2c963f66afa6',
        type: 'string',
        paramKey: 'string',
        isRequired: true,
        shouldLoadEntity: true
      }
    ],
    journey_type: 'Sales template (Premium)',
    protected: true,
    settings: {
      embedOptions: {
        mode: 'full-screen',
        lang: 'de',
        width: 'string',
        topBar: true,
        scrollToTop: true,
        button: {
          text: 'string',
          align: 'left'
        }
      },
      safeModeAutomation: true,
      designId: 'string',
      entityId: 'string',
      mappingsAutomationId: 'string',
      templateId: 'string',
      targetedCustomer: 'string',
      description: 'string',
      publicToken: 'string',
      runtimeEntities: ['ORDER'],
      filePurposes: ['string'],
      entityTags: ['string'],
      addressSuggestionsFileUrl: 'string',
      addressSuggestionsFileId: 'string',
      addressSuggestionsCountryCode: 'string',
      addressSuggestionsEnableAutoComplete: true,
      addressSuggestionsSource: ['string'],
      addressSuggestionsEnableFreeText: true,
      useNewDesign: true,
      thirdPartyCookies: true,
      accessMode: 'PUBLIC',
      enableDarkMode: true
    },
    validationRules: {
      block1: 'rule123',
      block2: {
        field1: 'rule456',
        field2: 'rule789'
      }
    },
    _manifest: ['123e4567-e89b-12d3-a456-426614174000']
  },
)
```

<details>
<summary>Response</summary>

```json
{
  "journeyId": "string",
  "brandId": "string",
  "name": "string",
  "steps": [
    {
      "showStepName": true,
      "title": "string",
      "subTitle": "string",
      "showStepSubtitle": true,
      "showStepper": true,
      "showStepperLabels": true,
      "hideNextButton": true,
      "name": "string",
      "stepId": "string",
      "schema": {},
      "uischema": {},
      "maxWidth": "small"
    }
  ],
  "design": {
    "logoUrl": "string",
    "theme": {},
    "designTokens": {}
  },
  "rules": [
    {
      "type": "inject",
      "sourceType": "journey",
      "source": "string",
      "target": "string"
    }
  ],
  "logics": [
    {
      "autoGeneratedId": "string",
      "conditions": ["string"],
      "actions": ["string"]
    }
  ],
  "logicsV4": {},
  "contextSchema": [
    {
      "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "type": "string",
      "paramKey": "string",
      "isRequired": true,
      "shouldLoadEntity": true
    }
  ],
  "journey_type": "Sales template (Premium)",
  "protected": true,
  "settings": {
    "embedOptions": {
      "mode": "full-screen",
      "lang": "de",
      "width": "string",
      "topBar": true,
      "scrollToTop": true,
      "button": {
        "text": "string",
        "align": "left"
      }
    },
    "safeModeAutomation": true,
    "designId": "string",
    "entityId": "string",
    "mappingsAutomationId": "string",
    "templateId": "string",
    "targetedCustomer": "string",
    "description": "string",
    "publicToken": "string",
    "runtimeEntities": ["ORDER"],
    "filePurposes": ["string"],
    "entityTags": ["string"],
    "addressSuggestionsFileUrl": "string",
    "addressSuggestionsFileId": "string",
    "addressSuggestionsCountryCode": "string",
    "addressSuggestionsEnableAutoComplete": true,
    "addressSuggestionsSource": ["string"],
    "addressSuggestionsEnableFreeText": true,
    "useNewDesign": true,
    "thirdPartyCookies": true,
    "accessMode": "PUBLIC",
    "enableDarkMode": true
  },
  "validationRules": {
    "block1": "rule123",
    "block2": {
      "field1": "rule456",
      "field2": "rule789"
    }
  },
  "_manifest": ["123e4567-e89b-12d3-a456-426614174000"]
}
```

</details>

---

### `updateJourneyV2`

Update a Journey

`PUT /v2/journey/configuration`

```ts
const { data } = await client.updateJourneyV2(
  null,
  {
    journeyId: 'string',
    brandId: 'string',
    name: 'string',
    steps: [
      {
        showStepName: true,
        title: 'string',
        subTitle: 'string',
        showStepSubtitle: true,
        showStepper: true,
        showStepperLabels: true,
        hideNextButton: true,
        name: 'string',
        stepId: 'string',
        schema: {},
        uischema: {},
        maxWidth: 'small'
      }
    ],
    design: {
      logoUrl: 'string',
      theme: {},
      designTokens: {}
    },
    rules: [
      {
        type: 'inject',
        sourceType: 'journey',
        source: 'string',
        target: 'string'
      }
    ],
    logics: [
      {
        autoGeneratedId: 'string',
        conditions: ['string'],
        actions: ['string']
      }
    ],
    logicsV4: {},
    contextSchema: [
      {
        id: '3fa85f64-5717-4562-b3fc-2c963f66afa6',
        type: 'string',
        paramKey: 'string',
        isRequired: true,
        shouldLoadEntity: true
      }
    ],
    journey_type: 'Sales template (Premium)',
    protected: true,
    settings: {
      embedOptions: {
        mode: 'full-screen',
        lang: 'de',
        width: 'string',
        topBar: true,
        scrollToTop: true,
        button: {
          text: 'string',
          align: 'left'
        }
      },
      safeModeAutomation: true,
      designId: 'string',
      entityId: 'string',
      mappingsAutomationId: 'string',
      templateId: 'string',
      targetedCustomer: 'string',
      description: 'string',
      publicToken: 'string',
      runtimeEntities: ['ORDER'],
      filePurposes: ['string'],
      entityTags: ['string'],
      addressSuggestionsFileUrl: 'string',
      addressSuggestionsFileId: 'string',
      addressSuggestionsCountryCode: 'string',
      addressSuggestionsEnableAutoComplete: true,
      addressSuggestionsSource: ['string'],
      addressSuggestionsEnableFreeText: true,
      useNewDesign: true,
      thirdPartyCookies: true,
      accessMode: 'PUBLIC',
      enableDarkMode: true
    },
    validationRules: {
      block1: 'rule123',
      block2: {
        field1: 'rule456',
        field2: 'rule789'
      }
    },
    _manifest: ['123e4567-e89b-12d3-a456-426614174000']
  },
)
```

<details>
<summary>Response</summary>

```json
{
  "journeyId": "string",
  "brandId": "string",
  "name": "string",
  "steps": [
    {
      "showStepName": true,
      "title": "string",
      "subTitle": "string",
      "showStepSubtitle": true,
      "showStepper": true,
      "showStepperLabels": true,
      "hideNextButton": true,
      "name": "string",
      "stepId": "string",
      "schema": {},
      "uischema": {},
      "maxWidth": "small"
    }
  ],
  "design": {
    "logoUrl": "string",
    "theme": {},
    "designTokens": {}
  },
  "rules": [
    {
      "type": "inject",
      "sourceType": "journey",
      "source": "string",
      "target": "string"
    }
  ],
  "logics": [
    {
      "autoGeneratedId": "string",
      "conditions": ["string"],
      "actions": ["string"]
    }
  ],
  "logicsV4": {},
  "contextSchema": [
    {
      "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "type": "string",
      "paramKey": "string",
      "isRequired": true,
      "shouldLoadEntity": true
    }
  ],
  "journey_type": "Sales template (Premium)",
  "protected": true,
  "settings": {
    "embedOptions": {
      "mode": "full-screen",
      "lang": "de",
      "width": "string",
      "topBar": true,
      "scrollToTop": true,
      "button": {
        "text": "string",
        "align": "left"
      }
    },
    "safeModeAutomation": true,
    "designId": "string",
    "entityId": "string",
    "mappingsAutomationId": "string",
    "templateId": "string",
    "targetedCustomer": "string",
    "description": "string",
    "publicToken": "string",
    "runtimeEntities": ["ORDER"],
    "filePurposes": ["string"],
    "entityTags": ["string"],
    "addressSuggestionsFileUrl": "string",
    "addressSuggestionsFileId": "string",
    "addressSuggestionsCountryCode": "string",
    "addressSuggestionsEnableAutoComplete": true,
    "addressSuggestionsSource": ["string"],
    "addressSuggestionsEnableFreeText": true,
    "useNewDesign": true,
    "thirdPartyCookies": true,
    "accessMode": "PUBLIC",
    "enableDarkMode": true
  },
  "validationRules": {
    "block1": "rule123",
    "block2": {
      "field1": "rule456",
      "field2": "rule789"
    }
  },
  "_manifest": ["123e4567-e89b-12d3-a456-426614174000"]
}
```

</details>

---

### `patchUpdateJourneyV2`

Update a Journey (partially / patch). Support for nested properties updates (e.g. "property[0].name").

`PATCH /v2/journey/configuration`

```ts
const { data } = await client.patchUpdateJourneyV2(
  null,
  {
    journeyId: '509cdffe-424f-457a-95c2-9708c304ce77',
    __lastModifiedAt: 'string'
  },
)
```

<details>
<summary>Response</summary>

```json
{
  "journeyId": "string",
  "brandId": "string",
  "name": "string",
  "steps": [
    {
      "showStepName": true,
      "title": "string",
      "subTitle": "string",
      "showStepSubtitle": true,
      "showStepper": true,
      "showStepperLabels": true,
      "hideNextButton": true,
      "name": "string",
      "stepId": "string",
      "schema": {},
      "uischema": {},
      "maxWidth": "small"
    }
  ],
  "design": {
    "logoUrl": "string",
    "theme": {},
    "designTokens": {}
  },
  "rules": [
    {
      "type": "inject",
      "sourceType": "journey",
      "source": "string",
      "target": "string"
    }
  ],
  "logics": [
    {
      "autoGeneratedId": "string",
      "conditions": ["string"],
      "actions": ["string"]
    }
  ],
  "logicsV4": {},
  "contextSchema": [
    {
      "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "type": "string",
      "paramKey": "string",
      "isRequired": true,
      "shouldLoadEntity": true
    }
  ],
  "journey_type": "Sales template (Premium)",
  "protected": true,
  "settings": {
    "embedOptions": {
      "mode": "full-screen",
      "lang": "de",
      "width": "string",
      "topBar": true,
      "scrollToTop": true,
      "button": {
        "text": "string",
        "align": "left"
      }
    },
    "safeModeAutomation": true,
    "designId": "string",
    "entityId": "string",
    "mappingsAutomationId": "string",
    "templateId": "string",
    "targetedCustomer": "string",
    "description": "string",
    "publicToken": "string",
    "runtimeEntities": ["ORDER"],
    "filePurposes": ["string"],
    "entityTags": ["string"],
    "addressSuggestionsFileUrl": "string",
    "addressSuggestionsFileId": "string",
    "addressSuggestionsCountryCode": "string",
    "addressSuggestionsEnableAutoComplete": true,
    "addressSuggestionsSource": ["string"],
    "addressSuggestionsEnableFreeText": true,
    "useNewDesign": true,
    "thirdPartyCookies": true,
    "accessMode": "PUBLIC",
    "enableDarkMode": true
  },
  "validationRules": {
    "block1": "rule123",
    "block2": {
      "field1": "rule456",
      "field2": "rule789"
    }
  },
  "_manifest": ["123e4567-e89b-12d3-a456-426614174000"]
}
```

</details>

---

### `getJourneyV2`

Get journey by id

`GET /v2/journey/configuration/{id}`

```ts
const { data } = await client.getJourneyV2({
  id: '123e4567-e89b-12d3-a456-426614174000',
})
```

<details>
<summary>Response</summary>

```json
{
  "journeyId": "string",
  "brandId": "string",
  "name": "string",
  "steps": [
    {
      "showStepName": true,
      "title": "string",
      "subTitle": "string",
      "showStepSubtitle": true,
      "showStepper": true,
      "showStepperLabels": true,
      "hideNextButton": true,
      "name": "string",
      "stepId": "string",
      "schema": {},
      "uischema": {},
      "maxWidth": "small"
    }
  ],
  "design": {
    "logoUrl": "string",
    "theme": {},
    "designTokens": {}
  },
  "rules": [
    {
      "type": "inject",
      "sourceType": "journey",
      "source": "string",
      "target": "string"
    }
  ],
  "logics": [
    {
      "autoGeneratedId": "string",
      "conditions": ["string"],
      "actions": ["string"]
    }
  ],
  "logicsV4": {},
  "contextSchema": [
    {
      "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "type": "string",
      "paramKey": "string",
      "isRequired": true,
      "shouldLoadEntity": true
    }
  ],
  "journey_type": "Sales template (Premium)",
  "protected": true,
  "settings": {
    "embedOptions": {
      "mode": "full-screen",
      "lang": "de",
      "width": "string",
      "topBar": true,
      "scrollToTop": true,
      "button": {
        "text": "string",
        "align": "left"
      }
    },
    "safeModeAutomation": true,
    "designId": "string",
    "entityId": "string",
    "mappingsAutomationId": "string",
    "templateId": "string",
    "targetedCustomer": "string",
    "description": "string",
    "publicToken": "string",
    "runtimeEntities": ["ORDER"],
    "filePurposes": ["string"],
    "entityTags": ["string"],
    "addressSuggestionsFileUrl": "string",
    "addressSuggestionsFileId": "string",
    "addressSuggestionsCountryCode": "string",
    "addressSuggestionsEnableAutoComplete": true,
    "addressSuggestionsSource": ["string"],
    "addressSuggestionsEnableFreeText": true,
    "useNewDesign": true,
    "thirdPartyCookies": true,
    "accessMode": "PUBLIC",
    "enableDarkMode": true
  },
  "validationRules": {
    "block1": "rule123",
    "block2": {
      "field1": "rule456",
      "field2": "rule789"
    }
  },
  "_manifest": ["123e4567-e89b-12d3-a456-426614174000"]
}
```

</details>

---

### `removeJourneyV2`

Remove journey by id

`DELETE /v2/journey/configuration/{id}`

```ts
const { data } = await client.removeJourneyV2({
  id: '123e4567-e89b-12d3-a456-426614174000',
})
```

---

### `getSettingsForJourney`

Get settings related to the journey using journey ID.

`GET /v1/journey/{id}/settings`

```ts
const { data } = await client.getSettingsForJourney({
  id: '123e4567-e89b-12d3-a456-426614174000',
})
```

<details>
<summary>Response</summary>

```json
{
  "organizationId": "739224",
  "canary": true,
  "thirdPartyCookies": true
}
```

</details>

---

### `getButtonOptions`

Get button options from a csv file.

`GET /v1/journey/button-options`

```ts
const { data } = await client.getButtonOptions({
  fileId: 'example',
})
```

<details>
<summary>Response</summary>

```json
[
  {
    "value": "Button Hidden Value",
    "label": "Button Label"
  }
]
```

</details>

---

## Schemas

### `GetJourneysResponse`

```ts
type GetJourneysResponse = object
```

### `JourneyResponse`

```ts
type JourneyResponse = {
  createdJourney?: {
    journeyId?: string
    organizationId: string
    brandId?: string
    name: string
    steps: Array<{
      showStepName?: { ... }
      title?: { ... }
      subTitle?: { ... }
      showStepSubtitle?: { ... }
      showStepper?: { ... }
      showStepperLabels?: { ... }
      hideNextButton?: { ... }
      name: { ... }
      stepId?: { ... }
      schema: { ... }
      uischema: { ... }
      maxWidth?: { ... }
    }>
    design?: {
      logoUrl?: { ... }
      theme?: { ... }
      designTokens?: { ... }
    }
    rules?: Array<{
      type: { ... }
      sourceType: { ... }
      source: { ... }
      target: { ... }
    }>
    logics?: Array<{
      autoGeneratedId?: { ... }
      conditions: { ... }
      actions: { ... }
    }>
    logicsV4?: Record<string, {
      id?: { ... }
      protected?: { ... }
      action?: { ... }
      triggeredOn?: { ... }
      conditions?: { ... }
      settings?: { ... }
    }>
    contextSchema?: Array<{
      id?: { ... }
      type: { ... }
      paramKey: { ... }
      isRequired?: { ... }
      shouldLoadEntity?: { ... }
    }>
    journey_type?: string
    protected?: boolean
    settings?: {
      embedOptions?: { ... }
      safeModeAutomation?: { ... }
      canary?: { ... }
      designId: { ... }
      templateId?: { ... }
      entityId?: { ... }
      mappingsAutomationId?: { ... }
      targetedCustomer?: { ... }
      description?: { ... }
      organizationSettings?: { ... }
      publicToken?: { ... }
      runtimeEntities?: { ... }
      filePurposes?: { ... }
      entityTags?: { ... }
      addressSuggestionsFileUrl?: { ... }
      addressSuggestionsFileId?: { ... }
      addressSuggestionsCountryCode?: { ... }
      addressSuggestionsEnableAutoComplete?: { ... }
      addressSuggestionsSource?: { ... }
      addressSuggestionsEnableFreeText?: { ... }
      useNewDesign?: { ... }
      useAustrianLabels?: { ... }
      enableDarkMode?: { ... }
      accessMode?: { ... }
      isPublished?: { ... }
      status?: { ... }
      isActive?: { ... }
      savingProgress?: { ... }
      thirdPartyCookies?: { ... }
    }
    validationRules?: Record<string, string | Record<string, string>>
    createdBy?: string
    updatedBy?: string
    __lastModifiedAt?: string
    createdAt: string
    lastModifiedAt: string
    deletedAt?: string
    version: number
    revisions: number
    featureFlags?: Record<string, unknown>
  }
}
```

### `JourneyProductsResponse`

```ts
type JourneyProductsResponse = Array<{
  type?: string
  _schema?: string
  _title?: string
  name?: string
  _id?: string
  _org?: string
  code?: string
  description?: string
  feature?: unknown[]
  product_images?: unknown[]
  legal_footnote?: string
  product_downloads?: unknown[]
  price?: object
}>
```

### `PatchUpdateJourneyRequest`

Patch request to update a journey (journey id is required) Support for nested properties (e.g. steps[0].uischema.elements[0].products) is supported.


```ts
type PatchUpdateJourneyRequest = {
  journeyId: string // uuid
  __lastModifiedAt?: string
}
```

### `JourneyCreationRequest`

```ts
type JourneyCreationRequest = {
  journeyId?: string
  organizationId: string
  brandId?: string
  name: string
  steps: Array<{
    showStepName?: boolean
    title?: string
    subTitle?: string
    showStepSubtitle?: boolean
    showStepper?: boolean
    showStepperLabels?: boolean
    hideNextButton?: boolean
    name: string
    stepId?: string
    schema: unknown
    uischema: unknown
    maxWidth?: "small" | "medium" | "large" | "extra large"
  }>
  design?: {
    logoUrl?: string
    theme?: Record<string, unknown>
    designTokens?: object
  }
  rules?: Array<{
    type: "inject" | "injectWithKey"
    sourceType: "journey" | "step" | "block"
    source: string
    target: string
  }>
  logics?: Array<{
    autoGeneratedId?: string
    conditions: string[]
    actions: string[]
  }>
  logicsV4?: Record<string, {
    id?: string // uuid
    protected?: boolean
    action?: string
    triggeredOn?: string
    conditions?: Array<Array<{
      operator?: { ... }
      functionName?: { ... }
      fact?: { ... }
      value?: { ... }
      args?: { ... }
    }>>
    settings?: object
  }>
  contextSchema?: Array<{
    id?: string // uuid
    type: string
    paramKey: string
    isRequired?: boolean
    shouldLoadEntity?: boolean
  }>
  journey_type?: string
  protected?: boolean
  settings?: {
    embedOptions?: {
      mode?: { ... }
      lang?: { ... }
      width?: { ... }
      topBar?: { ... }
      scrollToTop?: { ... }
      button?: { ... }
    }
    safeModeAutomation?: boolean
    canary?: boolean
    designId: string
    templateId?: string
    entityId?: string
    mappingsAutomationId?: string
    targetedCustomer?: string
    description?: string
    organizationSettings?: Record<string, boolean>
    publicToken?: string
    runtimeEntities?: "ORDER" | "OPPORTUNITY"[]
    filePurposes?: string[]
    entityTags?: string[]
    addressSuggestionsFileUrl?: string
    addressSuggestionsFileId?: string
    addressSuggestionsCountryCode?: string
    addressSuggestionsEnableAutoComplete?: boolean
    addressSuggestionsSource?: string[]
    addressSuggestionsEnableFreeText?: boolean
    useNewDesign?: boolean
    useAustrianLabels?: boolean
    enableDarkMode?: boolean
    accessMode?: "PUBLIC" | "PRIVATE"
    isPublished?: boolean
    status?: string
    isActive?: boolean
    savingProgress?: {
      savingMode?: { ... }
      supportedVersion?: { ... }
    }
    thirdPartyCookies?: boolean
  }
  validationRules?: Record<string, string | Record<string, string>>
  // ...
}
```

### `JourneyCreationRequestV2`

```ts
type JourneyCreationRequestV2 = {
  journeyId?: string
  brandId?: string
  name: string
  steps: Array<{
    showStepName?: boolean
    title?: string
    subTitle?: string
    showStepSubtitle?: boolean
    showStepper?: boolean
    showStepperLabels?: boolean
    hideNextButton?: boolean
    name: string
    stepId?: string
    schema: unknown
    uischema: unknown
    maxWidth?: "small" | "medium" | "large" | "extra large"
  }>
  design?: {
    logoUrl?: string
    theme?: Record<string, unknown>
    designTokens?: object
  }
  rules?: Array<{
    type: "inject" | "injectWithKey"
    sourceType: "journey" | "step" | "block"
    source: string
    target: string
  }>
  logics?: Array<{
    autoGeneratedId?: string
    conditions: string[]
    actions: string[]
  }>
  logicsV4?: Record<string, {
    id?: string // uuid
    protected?: boolean
    action?: string
    triggeredOn?: string
    conditions?: Array<Array<{
      operator?: { ... }
      functionName?: { ... }
      fact?: { ... }
      value?: { ... }
      args?: { ... }
    }>>
    settings?: object
  }>
  contextSchema?: Array<{
    id?: string // uuid
    type: string
    paramKey: string
    isRequired?: boolean
    shouldLoadEntity?: boolean
  }>
  journey_type?: string
  protected?: boolean
  settings?: {
    embedOptions?: {
      mode?: { ... }
      lang?: { ... }
      width?: { ... }
      topBar?: { ... }
      scrollToTop?: { ... }
      button?: { ... }
    }
    safeModeAutomation?: boolean
    designId?: string
    entityId?: string
    mappingsAutomationId?: string
    templateId?: string
    targetedCustomer?: string
    description?: string
    publicToken?: string
    runtimeEntities?: "ORDER" | "OPPORTUNITY"[]
    filePurposes?: string[]
    entityTags?: string[]
    addressSuggestionsFileUrl?: string
    addressSuggestionsFileId?: string
    addressSuggestionsCountryCode?: string
    addressSuggestionsEnableAutoComplete?: boolean
    addressSuggestionsSource?: string[]
    addressSuggestionsEnableFreeText?: boolean
    useNewDesign?: boolean
    thirdPartyCookies?: boolean
    accessMode?: "PUBLIC" | "PRIVATE"
    enableDarkMode?: boolean
  }
  validationRules?: Record<string, string | Record<string, string>>
  _manifest?: string // uuid[]
}
```

### `SearchJourneysQueryRequest`

```ts
type SearchJourneysQueryRequest = {
  q?: string
  from?: number
  size?: number
  sort?: string
}
```

### `SearchJourneysResponse`

```ts
type SearchJourneysResponse = {
  hits?: number
  results?: Array<{
    _id?: string // uuid
    _schema?: string
    _title?: string
    _org?: string
    _created_at?: string // date-time
    _updated_at?: string // date-time
    _tags?: string[]
    _manifest?: string // uuid[]
    journey_name?: string
    journey_id?: string // uuid
    journey_type?: string
    design?: string
    created_by?: Array<{
      id?: { ... }
    }>
    journey_version?: "Flex"
  }>
}
```

### `Journey`

```ts
type Journey = {
  journeyId?: string
  organizationId: string
  brandId?: string
  name: string
  steps: Array<{
    showStepName?: boolean
    title?: string
    subTitle?: string
    showStepSubtitle?: boolean
    showStepper?: boolean
    showStepperLabels?: boolean
    hideNextButton?: boolean
    name: string
    stepId?: string
    schema: unknown
    uischema: unknown
    maxWidth?: "small" | "medium" | "large" | "extra large"
  }>
  design?: {
    logoUrl?: string
    theme?: Record<string, unknown>
    designTokens?: object
  }
  rules?: Array<{
    type: "inject" | "injectWithKey"
    sourceType: "journey" | "step" | "block"
    source: string
    target: string
  }>
  logics?: Array<{
    autoGeneratedId?: string
    conditions: string[]
    actions: string[]
  }>
  logicsV4?: Record<string, {
    id?: string // uuid
    protected?: boolean
    action?: string
    triggeredOn?: string
    conditions?: Array<Array<{
      operator?: { ... }
      functionName?: { ... }
      fact?: { ... }
      value?: { ... }
      args?: { ... }
    }>>
    settings?: object
  }>
  contextSchema?: Array<{
    id?: string // uuid
    type: string
    paramKey: string
    isRequired?: boolean
    shouldLoadEntity?: boolean
  }>
  journey_type?: string
  protected?: boolean
  settings?: {
    embedOptions?: {
      mode?: { ... }
      lang?: { ... }
      width?: { ... }
      topBar?: { ... }
      scrollToTop?: { ... }
      button?: { ... }
    }
    safeModeAutomation?: boolean
    canary?: boolean
    designId: string
    templateId?: string
    entityId?: string
    mappingsAutomationId?: string
    targetedCustomer?: string
    description?: string
    organizationSettings?: Record<string, boolean>
    publicToken?: string
    runtimeEntities?: "ORDER" | "OPPORTUNITY"[]
    filePurposes?: string[]
    entityTags?: string[]
    addressSuggestionsFileUrl?: string
    addressSuggestionsFileId?: string
    addressSuggestionsCountryCode?: string
    addressSuggestionsEnableAutoComplete?: boolean
    addressSuggestionsSource?: string[]
    addressSuggestionsEnableFreeText?: boolean
    useNewDesign?: boolean
    useAustrianLabels?: boolean
    enableDarkMode?: boolean
    accessMode?: "PUBLIC" | "PRIVATE"
    isPublished?: boolean
    status?: string
    isActive?: boolean
    savingProgress?: {
      savingMode?: { ... }
      supportedVersion?: { ... }
    }
    thirdPartyCookies?: boolean
  }
  validationRules?: Record<string, string | Record<string, string>>
  // ...
}
```

### `JourneyFeatureFlags`

```ts
type JourneyFeatureFlags = {
  featureFlags?: Record<string, unknown>
}
```

### `JourneyAuditInfo`

```ts
type JourneyAuditInfo = {
  createdAt: string
  lastModifiedAt: string
  deletedAt?: string
  version: number
  revisions: number
}
```

### `JourneyValidationResponse`

```ts
type JourneyValidationResponse = {
  valid: boolean
  errors: Array<{
    type?: string
    severity?: "critical" | "high" | "medium" | "low"
    message?: string
    affectedStepIds?: string[]
    count?: number
    autoFix?: {
      feasible?: { ... }
      confidence?: { ... }
      reason?: { ... }
      details?: { ... }
    }
  }>
  warnings?: Array<{
    type?: string
    message?: string
  }>
}
```

### `JourneyValidationError`

```ts
type JourneyValidationError = {
  error: string
  message: string
  details: Array<{
    pattern?: string
    severity?: "critical" | "high" | "medium" | "low"
    message?: string
    count?: number
  }>
}
```

### `S3Reference`

```ts
type S3Reference = {
  bucket: string
  key: string
}
```

### `TemplateSettings`

Template Settings for document generation

```ts
type TemplateSettings = {
  custom_margins?: {
    top?: number
    bottom?: number
  }
  suggested_margins?: {
    top?: number
    bottom?: number
  }
  display_margin_guidelines?: boolean
  enable_data_table_margin_autofix?: boolean
  template_with_datatable?: boolean
  enabled_template_settings_persistence?: boolean
  misconfigured_margins?: boolean
  file_entity_id?: string // uuid
}
```

### `GenerateDocumentResponse`

```ts
type GenerateDocumentResponse = {
  job_id?: string // uuid
  job_status?: "STARTED" | "PROCESSING" | "SUCCESS" | "FAILED"
  message?: string
  pdf_output?: {
    preview_url?: string
    output_document?: {
      filename?: { ... }
      s3ref?: { ... }
    }
  }
  docx_output?: {
    preview_url?: string
    output_document?: {
      filename?: { ... }
      s3ref?: { ... }
    }
  }
  variable_payload?: {
    additionalProperties?: string
  }
  template_settings?: {
    custom_margins?: {
      top?: { ... }
      bottom?: { ... }
    }
    suggested_margins?: {
      top?: { ... }
      bottom?: { ... }
    }
    display_margin_guidelines?: boolean
    enable_data_table_margin_autofix?: boolean
    template_with_datatable?: boolean
    enabled_template_settings_persistence?: boolean
    misconfigured_margins?: boolean
    file_entity_id?: string // uuid
  }
}
```

### `GenerateDocumentRequest`

```ts
type GenerateDocumentRequest = {
  file_id: string
  context_data: {
    additionalProperties?: string
  }
  language?: string
}
```

### `GetSettingsForJourney`

```ts
type GetSettingsForJourney = {
  organizationId?: string
  canary?: boolean
  thirdPartyCookies?: boolean
}
```

### `ButtonOption`

A single button option data

```ts
type ButtonOption = {
  value?: string
  label?: string
}
```

### `ValidationRuleRef`

References to validation rules organized by blocks and fields.
Maps block IDs to either rule IDs (for block-level rules) or rule references (for field-level rules).


```ts
type ValidationRuleRef = Record<string, string | Record<string, string>>
```

### `RuleRef`

Field-level rule references within a block.
Maps field names to rule IDs.


```ts
type RuleRef = Record<string, string>
```
