# Create a sitemap rule

**Publié le** : 2026-05-08
**Catégorie** : SEO & Analytics

## `POST /sitemap/rules`

**Create a sitemap rule**

Creates a new URL rule for the sitemap.

Required permissions: `sitemap.create`

### Request Body

Content-Type: `application/json`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `sourceType` | "content_type" \| "category" \| "tag" \| "path_pattern" | Yes | Required. One of: content_type, category, tag, path_pattern |
| `sourceValue` | string | Yes | Required. 1-255 characters |
| `priority` | number | Yes | Required. Between 0 and 1 |
| `changefreq` | "always" \| "hourly" \| "daily" \| "weekly" \| "monthly" \| "yearly" \| "never" | Yes | Required. One of: always, hourly, daily, weekly, monthly, yearly, never |
| `ruleOrder` | number | No | Number |


### Responses

| Status | Description |
| --- | --- |
| `201` | Successful response |
| `401` | Unauthorized — invalid or missing API token |
| `403` | Forbidden — insufficient permissions |
| `422` | Validation error |


### Examples

```bash
curl -X POST https://api.lynkow.com/v1/sitemap/rules \
  -H "Authorization: Bearer $API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"pattern": "/old-path/*", "replacement": "/new-path/*"}'
```

### Response Example

```json
{
  "data": {
    "id": 2,
    "pattern": "/old-path/*",
    "replacement": "/new-path/*",
    "isActive": true,
    "createdAt": "2025-04-06T12:00:00.000Z"
  }
}
```

---