---
schema_version: "1"
id: 55174ec735484cc5fc9710da0fe8c0ec913e723a67171f5ea8fc2d97024bf6c9
title: Accessing Policy Metadata
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/pdk/latest/policies-pdk-configure-features-metadata.md
canonical_url: https://docs.mulesoft.com/pdk/latest/policies-pdk-configure-features-metadata
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 157a718f1134a5325fa1fff117806fe5780753c289c8ba0003a56a231f8ab00b
description: MuleSoft Documentation Site
release: "1.10"
latest: true
---
---
product: Omni Gateway Policy Development Kit (PDK)
version: 1.10
is-latest-version: true
---

# Accessing Policy Metadata

> For the full documentation index, see: https://docs.mulesoft.com/llms.txt

PDK exposes a `Metadata` injectable that provides metadata about the policy, the Omni instance, the
API instance, and the Anypoint Organization. The `Metadata` struct is as follows:

```Rust
pub struct Metadata {
    pub flex_metadata: FlexMetadata,
    pub policy_metadata: PolicyMetadata,
    pub api_metadata: ApiMetadata,
    pub platform_metadata: PlatformMetadata,
}
```

The `Metadata` struct references the following structures:

- `FlexMetadata`:

  ```Rust
  pub struct FlexMetadata {
      pub flex_name: String,
      pub flex_version: String,
  }
  ```

- `PolicyMetadata`:

  ```Rust
  pub struct PolicyMetadata {
      pub policy_name: String,
      pub policy_namespace: String,
  }
  ```

- `ApiMetadata`:

  ```Rust
  pub struct ApiMetadata {
      pub id: Option<String>,
      pub name: Option<String>,
      pub version: Option<String>,
      pub slas: Option<Vec<ApiSla>>, // API SLA tiers in the platform
  }

  // Each ApiSla contains the limits for each SLA.
  pub struct ApiSla {
      pub id: String,
      pub tiers: Vec<Tier>, // Limits within an API SLA tier in the platform
  }
  ```

- `PlatformMetadata`:

  ```Rust
  pub struct PlatformMetadata {
      pub organization_id: String,
      pub environment_id: String,
      pub root_organization_id: String,
  }
  ```

## Inject Metadata into the #\[entrypoint\]

To inject metadata into the `#[entrypoint]` configuration function, see the following code snippet:

```Rust
#[entrypoint]
async fn configure(launcher: Launcher, metadata: Metadata) -> Result<()> {
    logger::info!("Flex instance name is: {}", metadata.flex_metadata.flex_name.to_string());

    launcher
        .launch(on_request(filter))
        .await?;
    Ok(())
}
```

## Inject Metadata into the Wrapped Functions

You cannot directly inject metadata into the wrapped functions. To use metadata in the wrapped
functions, first inject the data into the `#[entrypoint]` function and then the wrapped function:

```Rust
#[entrypoint]
async fn configure(launcher: Launcher, metadata: Metadata) -> Result<()> {
    launcher
        .launch(on_request(|r| request_filter(r, &metadata)))
        .await?;
    Ok(())
}

async fn request_filter(_: RequestState, metadata: &Metadata) -> Flow<()> {
    let mut vec = Vec::new();
    let headers = &mut vec;
    headers.push((
        "flex_name".to_string(),
        metadata.flex_metadata.flex_name.to_string(),
    ));
    headers.push((
        "policy_name".to_string(),
        metadata.policy_metadata.policy_name.to_string(),
    ));

    Flow::Break(Response::new(201).with_headers(vec))
}
```

## See Also

- [Injecting Parameters](https://docs.mulesoft.com/pdk/latest/policies-pdk-configure-features-inject-parameters)
