---
title: "Create an enrichment schema"
method: POST
path: "/enrichment/schemas"
tags: ["Enrichment Schemas"]
---

# Create an enrichment schema

`POST /enrichment/schemas`

Creates an enrichment schema. Provide a JSON body to define the schema explicitly (returns `201`), or upload a CSV file as `multipart/form-data` or `text/csv` to auto-generate a schema from the file's columns — the first column becomes a query field and the rest become enriched fields (returns `202` once the file is accepted for processing). A schema must include 1-3 query fields and at least one enriched field, up to 25 fields total, with unique (case-insensitive) field names. Schemas created through the API are always `CSV`, and an account may have at most 25 CSV schemas. CSV uploads are limited to 10 MB.

<!-- theme: warning -->

> ### Early Access
> This API is in Early Access and may change at any time. Contact your PagerDuty account team to request access.

Scoped OAuth requires: `contextual_data.write`

## Query parameters

- `filename` string

## Headers

- `Accept` string, required
- `Content-Type` 'application/json', required

## Request body

- object
  - `integration_type` 'CSV' — The schema source. Only `CSV` is supported through the API; the schema is always recorded as `CSV` regardless of the value sent.
  - `name` string, required — Display name of the enrichment schema.
  - `description` string — Description of this set of enrichment data.
  - `fields` object[], required — The schema fields. Must include 1-3 query fields and at least one enriched field, up to 25 fields total. Field names must be unique (case-insensitive).
    - `name` string, required — The name of the field. Must be unique within the schema (case-insensitive).
    - `type` 'query' | 'enriched', required — How the field is used. `query` fields match incoming events to records (case-insensitive); `enriched` fields carry the data added to a matched event.

## Response `201`

The enrichment schema was created successfully.

- object
  - `schema` EnrichmentSchema
    - `id` string, uuid — Unique identifier for the enrichment schema.
    - `type` string — The type of the resource.
    - `integration_type` 'CSV' | 'SERVICENOW' — The source of the enrichment schema. `CSV` schemas are created and populated through the schema and CSV-upload endpoints; `SERVICENOW` schemas are managed by the ServiceNow CMDB integration. Schemas created through the API are always `CSV`, and only `CSV` schemas can be deleted.
    - `name` string — Display name of the enrichment schema.
    - `description` string, nullable — Description of this set of enrichment data.
    - `fields` EnrichmentField[] — The fields that make up the schema, including both query and enriched fields. A schema must contain 1-3 `query` fields and at least one `enriched` field, up to a maximum of 25 fields. Field names are unique within the schema (case-insensitive).
      - `name` string, required — The name of the field. Unique within the schema (case-insensitive).
      - `type` 'query' | 'enriched' | 'discriminator', required — How the field is used during enrichment. `query` fields are used to match incoming events to enrichment records (matching is case-insensitive), and `enriched` fields carry the contextual data added to a matched event. A schema has 1-3 query fields and at least one enriched field. `discriminator` is reserved for internal use (for example, by the ServiceNow CMDB integration).
    - `created_at` string, date-time — Timestamp when the schema was created.
    - `updated_at` string, date-time — Timestamp when the schema was last updated.
    - `deleted_at` string, date-time, nullable — Timestamp when the schema was deleted, or `null` if it has not been deleted.

## Other responses

- `202` — The schema was created from the uploaded CSV and the file was accepted for asynchronous processing. The records become queryable once processing completes.
- `400` — Caller provided invalid arguments. Please review the response for error details. Retrying with the same arguments will *not* work.
- `401` — Caller did not supply credentials or did not provide the correct credentials. If you are using an API key, it may be invalid or your Authorization header may be malformed.
- `403` — Caller is not authorized to view the requested resource. While your authentication is valid, the authenticated user or token does not have permission to perform this action.
- `429` — Too many requests have been made, the rate limit has been reached.
- `500` — Internal Server Error the PagerDuty server experienced an error.

---

[API](https://skmtc.net/pagerduty/apis/rest-api.md) · [All operations](https://skmtc.net/pagerduty/apis/rest-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/pagerduty/rest-api/revisions/b679a8f3f02c/schema)
