---
type: api
title: Create SAML service provider metadata
description: Generate SAML metadata for a SAML 2.0 Service Provider.
url: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/elasticsearch/v8/operation/operation-security-saml-service-provider-metadata
resource: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/elasticsearch/v8/operation/operation-security-saml-service-provider-metadata
products:
  - Elasticsearch
---

# Create SAML service provider metadata

Availability: 7.11+

## Paths

- `GET` `/_security/saml/metadata/{realm_name}`

- [Api key auth](/elastic/docs-builder/docs/4371/api/doc/elasticsearch/v8/authentication#apikeyauth)
- [Basic auth](/elastic/docs-builder/docs/4371/api/doc/elasticsearch/v8/authentication#basicauth)
- [Bearer auth](/elastic/docs-builder/docs/4371/api/doc/elasticsearch/v8/authentication#bearerauth)

#### Path Parameters

- `realm_name` (string Name)
  The name of the SAML realm in Elasticsearch.

## Description

Generate SAML metadata for a SAML 2.0 Service Provider.

The SAML 2.0 specification provides a mechanism for Service Providers to describe their capabilities and configuration using a metadata file.
This API generates Service Provider metadata based on the configuration of a SAML realm in Elasticsearch.

## Response

`application/json`

- `metadata` (string)
  An XML string that contains a SAML Service Provider's metadata for the realm.
## Code Examples

#### Console

```console
POST /_security/profile/u_P_0BMHgaOK3p7k-PFWUCbw9dQ-UFjt01oWJ_Dp2PmPc_0/_data
```

#### JavaScript

```javascript
const response = await client.security.updateUserProfileData({
  uid: "u_P_0BMHgaOK3p7k-PFWUCbw9dQ-UFjt01oWJ_Dp2PmPc_0",
});
```

#### Python

```python
resp = client.security.update_user_profile_data(
    uid="u_P_0BMHgaOK3p7k-PFWUCbw9dQ-UFjt01oWJ_Dp2PmPc_0",
)
```

#### curl

```curl
curl -X POST "$ELASTICSEARCH_URL/_security/profile/u_P_0BMHgaOK3p7k-PFWUCbw9dQ-UFjt01oWJ_Dp2PmPc_0/_data" \
  -H "Authorization: ApiKey $ELASTIC_API_KEY"
```

#### Java

```java
client.security().updateUserProfileData(u -> u
    .uid("u_P_0BMHgaOK3p7k-PFWUCbw9dQ-UFjt01oWJ_Dp2PmPc_0")
);
```

#### C#

```c#
var response = await client.Security.UpdateUserProfileDataAsync(uid: "u_P_0BMHgaOK3p7k-PFWUCbw9dQ-UFjt01oWJ_Dp2PmPc_0");
```

#### PHP

```php
$resp = $client->security()->updateUserProfileData([
    "uid" => "u_P_0BMHgaOK3p7k-PFWUCbw9dQ-UFjt01oWJ_Dp2PmPc_0",
]);
```

#### Ruby

```ruby
response = client.security.update_user_profile_data(
  uid: "u_P_0BMHgaOK3p7k-PFWUCbw9dQ-UFjt01oWJ_Dp2PmPc_0"
)
```

## Response Examples

#### Saml service provider metadata response example1

A successful response from `POST /_security/profile/u_P_0BMHgaOK3p7k-PFWUCbw9dQ-UFjt01oWJ_Dp2PmPc_0/_data`, which indicates that the request is acknowledged.

```json
{
  "acknowledged": true
}
```

