---
title: Créer un embed
description: Créez un nouveau graphique intégrable.
breadcrumbs: Documentation > API > Créer un embed
---

> For the complete documentation index, see [llms.txt](https://dnd37xeb23o8n.cloudfront.net/jen.gilbert/astro-base/llms.txt).

# Créer un embed

## v1 (latest)

| Datadog site      | API endpoint                                          |
| ----------------- | ----------------------------------------------------- |
| app.datadoghq.com | POST https://api.datadoghq.com/api/v1/graph/embed     |
| us3.datadoghq.com | POST https://api.us3.datadoghq.com/api/v1/graph/embed |
| us5.datadoghq.com | POST https://api.us5.datadoghq.com/api/v1/graph/embed |
| app.datadoghq.eu  | POST https://api.datadoghq.eu/api/v1/graph/embed      |
| ap1.datadoghq.com | POST https://api.ap1.datadoghq.com/api/v1/graph/embed |
| ap2.datadoghq.com | POST https://api.ap2.datadoghq.com/api/v1/graph/embed |
| uk1.datadoghq.com | POST https://api.uk1.datadoghq.com/api/v1/graph/embed |
| app.ddog-gov.com  | POST https://api.ddog-gov.com/api/v1/graph/embed      |
| us2.ddog-gov.com  | POST https://api.us2.ddog-gov.com/api/v1/graph/embed  |

### Overview

Créez un nouveau graphique intégrable.

Remarque&nbsp;: si un embed existe déjà pour la même requête dans une organisation donnée, au lieu de créer un nouvel embed, l'embed existant est renvoyé. Si vous souhaitez utiliser des template variables, consultez la section [Graphiques intégrables avec des template variables] ([https://docs.datadoghq.com/dashboards/faq/embeddable-graphs-with-template-variables](https://docs.datadoghq.com/dashboards/faq/embeddable-graphs-with-template-variables.md)).

This endpoint requires the `embeddable_graphs_share` permission.

### Request

#### Body Data (required)

Corps de graphique intégrable

{% tabs %}
{% tab label="Model" %}
| Field                   | Type   | Description                                                                                                            |
| ----------------------- | ------ | ---------------------------------------------------------------------------------------------------------------------- |
| graph_json [*required*] | string | Charge utile pour créer un nouveau graphique intégrable.                                                               |
| legend                  | enum   | The flag determining if the graph includes a legend. Allowed enum values: `yes`, `no`. Default: `no`.                  |
| size                    | enum   | The size of the graph. Allowed enum values: `small`, `medium`, `large`, `xlarge`. Default: `medium`.                   |
| timeframe               | enum   | The timeframe for the graph. Allowed enum values: `1_hour`, `4_hours`, `1_day`, `2_days`, `1_week`. Default: `1_hour`. |
| title                   | string | Determines graph title. Must be at least 1 character. Default: `Embed created through API`.                            |
{% /tab %}

{% tab label="Example" %}
```json
{
  "graph_json": "",
  "legend": "string",
  "size": "string",
  "timeframe": "string",
  "title": "string"
}
```
{% /tab %}
{% /tabs %}

### Response

{% tabs %}
{% tab label="200" %}
Payload accepted

{% tabs %}
{% tab label="Model" %}
Embeddable graph.

| Field       | Type    | Description                                           |
| ----------- | ------- | ----------------------------------------------------- |
| dash_name   | string  | Name of the dashboard the graph is on (null if none). |
| dash_url    | string  | URL of the dashboard the graph is on (null if none).  |
| embed_id    | string  | ID of the embed.                                      |
| graph_title | string  | Title of the graph.                                   |
| html        | string  | HTML fragment for the embed (iframe).                 |
| revoked     | boolean | Boolean flag for whether or not the embed is revoked. |
| shared_by   | int64   | ID of the use who shared the embed.                   |
{% /tab %}

{% tab label="Example" %}
```json
{
  "dash_name": "string",
  "dash_url": "string",
  "embed_id": "string",
  "graph_title": "string",
  "html": "string",
  "revoked": false,
  "shared_by": "integer"
}
```
{% /tab %}
{% /tabs %}
{% /tab %}

{% tab label="400" %}
Bad Request

{% tabs %}
{% tab label="Model" %}
Error response object.

| Field               | Type     | Description                          |
| ------------------- | -------- | ------------------------------------ |
| errors [*required*] | [string] | Array of errors returned by the API. |
{% /tab %}

{% tab label="Example" %}
```json
{
  "errors": [
    "Bad Request"
  ]
}
```
{% /tab %}
{% /tabs %}
{% /tab %}

{% tab label="403" %}
Authentication Error

{% tabs %}
{% tab label="Model" %}
Error response object.

| Field               | Type     | Description                          |
| ------------------- | -------- | ------------------------------------ |
| errors [*required*] | [string] | Array of errors returned by the API. |
{% /tab %}

{% tab label="Example" %}
```json
{
  "errors": [
    "Bad Request"
  ]
}
```
{% /tab %}
{% /tabs %}
{% /tab %}

{% tab label="429" %}
Too many requests

{% tabs %}
{% tab label="Model" %}
Error response object.

| Field               | Type     | Description                          |
| ------------------- | -------- | ------------------------------------ |
| errors [*required*] | [string] | Array of errors returned by the API. |
{% /tab %}

{% tab label="Example" %}
```json
{
  "errors": [
    "Bad Request"
  ]
}
```
{% /tab %}
{% /tabs %}
{% /tab %}
{% /tabs %}

### Code Example

{% tabs %}
{% tab label="Curl" %}
```bash
# Set your Datadog site and credentials
export DD_SITE="datadoghq.com" # Or us3.datadoghq.com, us5.datadoghq.com, datadoghq.eu, ap1.datadoghq.com, ap2.datadoghq.com, uk1.datadoghq.com, ddog-gov.com, us2.ddog-gov.com
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v1/graph/embed" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "graph_json": "{\"viz\":\"timeseries\",\"requests\":[{\"q\":\"avg:system.load.1{*}\",\"type\":\"line\"}]}",
  "legend": "yes",
  "size": "medium",
  "timeframe": "1_hour",
  "title": "System Load Average"
}
EOF
```
{% /tab %}
{% /tabs %}
