---
title: "fswa_export_doc — Filter Hook"
description: "Attach top-level blocks to a Build export document before it is serialized."
url: "https://wpwebhooks.org/docs/fswa-export-doc/"
---

[WP Webhooks](https://wpwebhooks.org/) / [Docs](https://wpwebhooks.org/docs/) / fswa\_export\_doc

Filter since v2.4.0

# fswa\_export\_doc

Attach top-level blocks to a Build export document before it is serialized.

/ Signature

```
apply_filters( 'fswa_export_doc', $doc, $webhook_ids, $chain_ids )
```

/ When it fires

Fires once per export, after webhooks, chains, and credentials are collected and just before the JSON is returned. Pro uses it to bolt on an `ai_build` provenance block (the Build-with-AI transcript) when the exported objects trace back to an AI conversation.

/ Parameters

| Name | In | Type | Req | Description |
| --- | --- | --- | --- | --- |
| $doc | param | array | yes | The full export document (schema version, credentials, webhooks, chains). |
| $webhook\_ids | param | int\[\] | yes | Webhook IDs included in this export. |
| $chain\_ids | param | int\[\] | yes | Chain IDs included in this export. |

/ Returns

`array` The export document, optionally with extra top-level blocks added.

/ Examples

Stamp exports with the source site URL

```
add_filter( 'fswa_export_doc', function ( $doc, $webhook_ids, $chain_ids ) {
    $doc['exported_from'] = home_url();
    return $doc;
}, 10, 3 );
```

/ Related

[Import & Export](https://wpwebhooks.org/docs/import-export/)[fswa\_export\_trigger](https://wpwebhooks.org/docs/fswa-export-trigger/)[fswa\_import\_trigger](https://wpwebhooks.org/docs/fswa-import-trigger/)[fswa\_import\_extra\_root\_keys](https://wpwebhooks.org/docs/fswa-import-extra-root-keys/)

/Ready

## Your next automation is  
one sentence away.

[Install Plugin→](https://wordpress.org/plugins/flowsystems-webhook-actions/) [See the Plugin →](https://wpwebhooks.org/wordpress-webhook-plugin/)

$ wp plugin install flowsystems-webhook-actions --activate

## Structured data

```json
{"@context":"https://schema.org","@type":"TechArticle","name":"fswa_export_doc — Filter Hook — Webhook Actions Docs","description":"Attach top-level blocks to a Build export document before it is serialized.","url":"https://wpwebhooks.org/docs/fswa-export-doc/","isPartOf":{"@type":"WebSite","name":"WP Webhooks","url":"https://wpwebhooks.org"},"about":{"@type":"SoftwareApplication","name":"Webhook Actions","applicationCategory":"WordPress Plugin"}}
```
