> For the complete documentation index, see [llms.txt](https://developer.harness.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.harness.io/feature-management-experimentation/management-and-administration/api-best-practices/migrate-to-v4-api.md). Agents can also search and read this documentation through its [MCP server](https://developer.harness.io/~gitbook/mcp).

# Migrate from the Split Admin API to the Harness FME API

Learn how to move your Split Admin API calls to the Harness FME API, including authentication, required parameters, and endpoint mapping.

The Harness FME API replaces the Split Admin API for managing feature flags, segments, and related resources. It uses Harness authentication and project identifiers, and some request shapes changed. This guide helps you update your automation one endpoint at a time.

The Runtime Configuration API manages feature flags, segments, environments, experiments, and metrics in Harness FME. For the classic Harness Feature Flags product, go to the [Feature Flags API](https://developer.harness.io/api-reference/more-products-apis/feature-flags) instead.

## What you will learn from this topic

* How authentication, base URL, and project identifiers differ
* How Split endpoints map to Harness FME endpoints
* How update requests, pagination, and error handling changed
* Which Split endpoints have no Harness FME equivalent yet, and where to go for them

## Before you begin

* Create a Harness service account token or personal access token. Go to [Manage API keys](https://developer.harness.io/harness-platform/use-harness-platform/automation/api/add-and-manage-api-keys) to create one, and go to [API Keys](https://developer.harness.io/feature-management-experimentation/management-and-administration/api-keys.md) for details on API keys in FME.
* Find your Harness account identifier, organization identifier, and project identifier. Go to [Organizations and projects](https://developer.harness.io/harness-platform/use-harness-platform/organizations-and-projects) to find them.
* Inventory the Split endpoints that your scripts call. Your Customer Success Manager can provide a list of the endpoints and HTTP methods used by your account.

{% hint style="info" %}
**Split Admin API keys and migrated accounts**

The five administrative endpoints for users, groups, projects, project view permissions, and Admin API keys moved to the Harness platform during the Split to Harness migration. Go to [API for Split Admins](https://developer.harness.io/feature-management-experimentation/troubleshooting-and-resources/split-to-harness-migration/api-for-split-admins.md) for that mapping. This guide covers the feature flag, segment, environment, and traffic type endpoints.
{% endhint %}

## Request basics

Every Harness request follows the same pattern:

* **API key token:** Send a service account token or personal access token in the `x-api-key` header.
* **Account, organization, and project IDs:** Send `account_id`, `organization_identifier`, and `project_identifier` as query parameters on every request.
* **Environment ID:** Endpoints that work on a single environment also take `environment_id`.
* **Base URL:** Send requests to `https://app.harness.io/fme/api`, followed by the endpoint path. If your account is on a different Harness cluster or uses a vanity domain, replace `app.harness.io` with the domain you use to sign in to Harness.

For example, to list the feature flags in a project:

```bash
curl "https://app.harness.io/fme/api/v4/feature-flags?account_id=ACCOUNT_ID&organization_identifier=ORG_ID&project_identifier=PROJECT_ID" \
  -H "x-api-key: $HARNESS_API_KEY"
```

Replace `ACCOUNT_ID`, `ORG_ID`, and `PROJECT_ID` with your own values, and set `HARNESS_API_KEY` to your API key token.

## What changes between Split and Harness

| Area              | Split Admin API                                                                                                           | Harness API                                                                                         |
| ----------------- | ------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- |
| Base URL          | `https://api.split.io/internet/api/v2`                                                                                    | `https://app.harness.io/fme/api` (or your Harness domain), with `/v4` in each endpoint path         |
| Authentication    | `Authorization: Bearer <token>`, using a legacy Admin API key or a Harness service account token or personal access token | `x-api-key: <token>`, using a Harness service account token or personal access token only           |
| Project scope     | Workspace ID (`wsId`) in the URL path                                                                                     | `account_id`, `organization_identifier`, and `project_identifier` query parameters on every request |
| Environment scope | Environment in the URL path                                                                                               | `environment_id` query parameter on definition endpoints                                            |
| Resource names    | `splits` and `splits/ws/{wsId}/environments/{environmentId}`                                                              | `feature-flags` and `feature-flag-definitions`                                                      |
| Partial updates   | JSON Patch                                                                                                                | JSON Merge Patch (`application/merge-patch+json`)                                                   |
| Audit fields      | Not applicable                                                                                                            | `comment` and `title` in request bodies of change operations                                        |

### Authentication

Send your Harness service account token or personal access token in the `x-api-key` header. Do not send it as a bearer token. Split accepted legacy Admin API keys as well as Harness tokens. Harness accepts only service account tokens and personal access tokens, so create one before you migrate.

{% tabs %}
{% tab title="Split" %}

```bash
curl "https://api.split.io/internet/api/v2/splits/ws/WORKSPACE_ID" \
  -H "Authorization: Bearer $SPLIT_ADMIN_API_KEY"
```

{% endtab %}

{% tab title="Harness" %}

```bash
curl "https://app.harness.io/fme/api/v4/feature-flags?account_id=ACCOUNT_ID&organization_identifier=ORG_ID&project_identifier=PROJECT_ID" \
  -H "x-api-key: $HARNESS_API_KEY"
```

{% endtab %}
{% endtabs %}

### Project identifiers replace workspace IDs

Harness does not use the workspace ID in the URL. Send the three Harness identifiers as query parameters on every request. The Harness project identifier and the Split `wsId` are not interchangeable, so update any configuration that stores `wsId`.

### Map Split resources to Harness resources

To convert a Split call, change the resource names in the path and move the scope into query parameters:

1. Replace `splits` with `feature-flags` for flag-level operations, such as create, rename, or delete.
2. Replace `splits/ws/{wsId}/environments/{environmentId}` with `feature-flag-definitions` for environment-level operations, such as targeting rules, kill, and restore. Send the environment as `environment_id`.
3. Replace `segments` and `segments/ws/{wsId}/environments/{environmentId}` with `segments` and `segment-definitions` in the same way.
4. Remove `{wsId}` from the path and send the Harness identifiers as query parameters.

## Find an endpoint

Endpoint paths are relative to the base URL. The Harness API groups endpoints into these resources:

* **Feature flags:** The flag itself, including its name, traffic type, tags, and lifecycle. Go to [Create a Feature Flag and Target Users](https://developer.harness.io/feature-management-experimentation/new-to-fme/get-started/create-a-feature-flag.md) to create a feature flag.
* **Feature flag definitions:** A flag's settings in one environment, including its treatments, targeting rules, and traffic allocation. Kill, restore, and reallocate act here. Go to [Creating, editing, and deleting feature flags](https://developer.harness.io/feature-management-experimentation/management-and-administration/api-best-practices/feature-flags.md) to edit flag definitions through the API.
* **Segments and segment definitions:** Named lists of users or accounts that you target together. Go to [Create a segment](https://developer.harness.io/feature-management-experimentation/use-fme/feature-management/targeting/segments.md) to create a segment.
* **Environments:** Separate copies of your flag settings, such as staging and production. Go to [Environments](https://developer.harness.io/feature-management-experimentation/management-and-administration/environments.md) to manage environments.
* **Traffic types and event types:** What a flag targets, such as user or account, and the kinds of events you send to measure impact. Go to [Traffic types](https://developer.harness.io/feature-management-experimentation/management-and-administration/traffic-types.md) to set up traffic types.
* **Experiments and metrics:** Tests that compare treatments, and the measures used to judge them. Go to [Create a metric](https://developer.harness.io/feature-management-experimentation/new-to-fme/get-started/create-a-metric.md) to create a metric.

## Endpoint mapping

Go to the [Harness FME API reference](https://developer.harness.io/api-reference/more-products-apis/feature-management-and-experimentation) for full request and response schemas.

### Feature flags

| Task                             | Split operation                        | Harness endpoint                                       |
| -------------------------------- | -------------------------------------- | ------------------------------------------------------ |
| List flags                       | List splits                            | `GET /v4/feature-flags`                                |
| Create a flag                    | Create split                           | `POST /v4/feature-flags`                               |
| Get a flag                       | Get split                              | `GET /v4/feature-flags/{feature-flag-name}`            |
| Update a flag or its description | Update split, Update split description | `PATCH /v4/feature-flags/{feature-flag-name}`          |
| Delete a flag                    | Delete split                           | `DELETE /v4/feature-flags/{feature-flag-name}`         |
| Archive a flag                   | Archive a feature flag                 | `POST /v4/feature-flags/{feature-flag-name}/archive`   |
| Unarchive a flag                 | Unarchive a feature flag               | `POST /v4/feature-flags/{feature-flag-name}/unarchive` |

### Feature flag definitions

| Task                                                 | Split operation                          | Harness endpoint                                                   |
| ---------------------------------------------------- | ---------------------------------------- | ------------------------------------------------------------------ |
| List the definitions of one flag across environments | Not available                            | `GET /v4/feature-flag-definitions` with `feature_flag_name`        |
| Get a definition                                     | Get split definition in environment      | `GET /v4/feature-flag-definitions/{feature-flag-name}`             |
| Create a definition                                  | Create split definition in environment   | `POST /v4/feature-flag-definitions/{feature-flag-name}`            |
| Update a definition                                  | Partial update and full update           | `PATCH /v4/feature-flag-definitions/{feature-flag-name}`           |
| Remove a definition                                  | Remove split definition from environment | `DELETE /v4/feature-flag-definitions/{feature-flag-name}`          |
| Kill a flag                                          | Kill split in environment                | `POST /v4/feature-flag-definitions/{feature-flag-name}/kill`       |
| Restore a flag                                       | Restore split in environment             | `POST /v4/feature-flag-definitions/{feature-flag-name}/restore`    |
| Reallocate traffic                                   | Reallocate traffic (reseed bucketing)    | `POST /v4/feature-flag-definitions/{feature-flag-name}/reallocate` |

### Segments and segment definitions

| Task                                   | Split operation                      | Harness endpoint                                          |
| -------------------------------------- | ------------------------------------ | --------------------------------------------------------- |
| List segments                          | List segments                        | `GET /v4/segments`                                        |
| Create a segment                       | Create segment                       | `POST /v4/segments`                                       |
| Delete a segment                       | Delete segment                       | `DELETE /v4/segments/{segment-name}`                      |
| List segments in an environment        | List segments in environment         | `GET /v4/segment-definitions`                             |
| Enable a segment in an environment     | Enable segment in environment        | `POST /v4/segment-definitions/{segment-name}`             |
| Deactivate a segment in an environment | Deactivate segment in environment    | `DELETE /v4/segment-definitions/{segment-name}`           |
| List keys                              | Get segment keys in environment      | `GET /v4/segment-definitions/{segment-name}/keys`         |
| Add or replace keys                    | Update segment keys (JSON or CSV)    | `POST /v4/segment-definitions/{segment-name}/keys`        |
| Remove keys                            | Remove segment keys from environment | `POST /v4/segment-definitions/{segment-name}/keys/remove` |

### Environments, traffic types, and event types

| Task                                         | Split operation   | Harness endpoint                                                |
| -------------------------------------------- | ----------------- | --------------------------------------------------------------- |
| List, create, update, or delete environments | Environments      | `GET`, `POST`, `PATCH`, and `DELETE` on `/v4/environments`      |
| List traffic types                           | Get traffic types | `GET /v4/traffic-types`                                         |
| List event types                             | Not available     | `GET /v4/event-types` and `GET /v4/event-types/{event-type-id}` |

The Harness FME API exposes traffic types as read-only. Create and delete traffic types in the Harness FME user interface.

### Experiments and metrics

The Harness FME API adds endpoints for experiments and metrics that have no counterpart in the Split Admin API. Use them to automate work that you previously did only in the user interface.

| Task                                 | Harness endpoint                                             |
| ------------------------------------ | ------------------------------------------------------------ |
| List or create experiments           | `GET` and `POST /v4/experiments`                             |
| Get, update, or delete an experiment | `GET`, `PATCH`, and `DELETE /v4/experiments/{experiment-id}` |
| List or create metrics               | `GET` and `POST /v4/metrics`                                 |
| Get, update, or delete a metric      | `GET`, `PATCH`, and `DELETE /v4/metrics/{metric-id}`         |

## Changes in request behavior

### Update with JSON Merge Patch

Split partial updates used JSON Patch, an array of operations. Harness uses JSON Merge Patch. Send only the fields you want to change in an object, and set the `Content-Type` header to `application/merge-patch+json`.

{% tabs %}
{% tab title="Split (JSON Patch)" %}

```json
[
  { "op": "replace", "path": "/description", "value": "Checkout redesign" }
]
```

{% endtab %}

{% tab title="Harness (JSON Merge Patch)" %}

```bash
curl -X PATCH "https://app.harness.io/fme/api/v4/feature-flags/checkout_redesign?account_id=ACCOUNT_ID&organization_identifier=ORG_ID&project_identifier=PROJECT_ID" \
  -H "x-api-key: $HARNESS_API_KEY" \
  -H "Content-Type: application/merge-patch+json" \
  -d '{ "description": "Checkout redesign" }'
```

{% endtab %}
{% endtabs %}

Harness has no full replace (`PUT`) operation for definitions. Replace a full-update call with a `PATCH` that contains the fields you want to set.

Creating a flag does not create a definition. Create the definition in each environment with `POST /v4/feature-flag-definitions/{feature-flag-name}`.

## Migrate your automation

{% stepper %}
{% step %}
**Create credentials.** Create a Harness service account token and store it where your scripts read secrets.
{% endstep %}

{% step %}
**Collect identifiers.** Record the account identifier, organization identifier, project identifier, and environment IDs for each project your scripts touch.
{% endstep %}

{% step %}
**Update the base URL and headers.** Switch to the Harness base URL and the `x-api-key` header.
{% endstep %}

{% step %}
**Map each call.** Use the endpoint tables above to replace each Split call, and update request bodies for merge patch.
{% endstep %}

{% step %}
**Test in a non-production environment.** Run the updated scripts against a test project and compare results with Split before you switch production automation.
{% endstep %}
{% endstepper %}

## Endpoints with no Harness equivalent

The Harness FME API does not yet include some Split endpoints. Keep using the Admin API for these until a Harness FME equivalent is published:

* Listing the definitions of all flags in one environment. Harness definition endpoints are scoped to a single flag, so loop over your flags and call the endpoints for each one.
* Attributes and identities
* Flag sets
* Change request actions, such as create and approve. Harness supports listing and searching change requests.
* Rollout statuses
* Tags

Users, user groups, projects, project view permissions, and Admin API keys are managed through the Harness platform APIs. Go to [API for Split Admins](https://developer.harness.io/feature-management-experimentation/troubleshooting-and-resources/split-to-harness-migration/api-for-split-admins.md) for the mapping.

## Troubleshooting

<details>

<summary>A request returns 401</summary>

Confirm that you send the token in the `x-api-key` header and not as a bearer token. Confirm that the token is a Harness service account token or personal access token. A legacy Split Admin API key does not authenticate v4 requests.

</details>

<details>

<summary>A request returns 400 for missing parameters</summary>

Send `account_id`, `organization_identifier`, and `project_identifier` on every request. Definition endpoints also require `environment_id`.

</details>

<details>

<summary>A definition or segment key change returns 403</summary>

The environment requires approval. Submit the change through an approval flow.

</details>

## Next steps

* Go to the [Harness FME API reference](https://developer.harness.io/api-reference/more-products-apis/feature-management-and-experimentation) for endpoint schemas.
* Go to [API best practices](https://developer.harness.io/feature-management-experimentation/management-and-administration/api-best-practices.md) for worked examples of flag and segment automation.
* Go to [API for Split Admins](https://developer.harness.io/feature-management-experimentation/troubleshooting-and-resources/split-to-harness-migration/api-for-split-admins.md) for the user, group, and project endpoints.

{% @harness-feedback/feedback %}
