> ## Documentation Index
> Fetch the complete documentation index at: https://docs.launchmystore.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Get Metafield by ID (Admin API only)

> Retrieve a single metafield by id. Available on the Admin API only — not in the OAuth App API.

# Get Metafield by ID

<Warning>
  This endpoint is available on the **Admin API** (merchant JWT) only. It is
  **not** exposed to OAuth-scoped apps. Apps must use
  [`GET /api/v1/metafields.json`](/api-reference/metafields/list) with
  `namespace` + `key` (or `ownerType` + `ownerId`) filters instead.
</Warning>

Returns a single metafield by its UUID. Used by the merchant admin and by
the admin's resource detail editors.

## Request

```bash theme={null}
curl -X GET "https://api.launchmystore.io/metafields/<id>" \
  -H "Authorization: Bearer <merchant-jwt>"
```

## Auth

Merchant JWT (owner, or staff with admin/manager access). The
metafield must belong to the merchant's store.

## Path parameters

<ParamField path="id" type="string" required>
  The metafield UUID.
</ParamField>

## Response

```json theme={null}
{
  "status": 200,
  "state": "success",
  "data": {
    "id": "e607f43e-9251-451e-a45c-38bf28d61154",
    "namespace": "custom",
    "key": "warranty_years",
    "value": 5,
    "raw_value": "5",
    "type": "number_integer",
    "owner_type": "product",
    "owner_id": "94995c07-e8a5-43f2-9d1a-18ccf8199adf",
    "app_id": null,
    "created_at": "2026-05-09T13:32:53.135Z",
    "updated_at": "2026-05-09T13:32:53.135Z"
  }
}
```

## How apps should look up a single metafield

Use the list endpoint with exact filters — values are keyed by
`(owner type, namespace, key, owner)`, so there is at most one match:

```bash theme={null}
curl -G "https://api.launchmystore.io/api/v1/metafields.json" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  --data-urlencode "ownerType=product" \
  --data-urlencode "ownerId=<productId>" \
  --data-urlencode "namespace=custom" \
  --data-urlencode "key=warranty_years"
```

Returns at most one item under `data.metafields[0]`.

## Error codes

| Code           | Description                                          |
| -------------- | ---------------------------------------------------- |
| `UNAUTHORIZED` | Invalid or missing JWT                               |
| `FORBIDDEN`    | Wrong store / insufficient role                      |
| `NOT_FOUND`    | Metafield does not exist or belongs to another store |
