# Commit a search profile

`PUT /profiles/{profileId}`



[AI Search API guide](https://docs.contextual.io/tenants/tenant-apis/ai-search-api.md)

```json
{
  "openapi": "3.0.3",
  "info": {
    "title": "AI Search Api",
    "description": " ",
    "version": "1.7.5"
  },
  "security": [
    {
      "jwt": []
    }
  ],
  "servers": [
    {
      "url": "https://ai-search.{tenantId}.my.contextual.io/api/v1",
      "variables": {
        "tenantId": {
          "default": "YOUR-TENANT-ID"
        }
      }
    }
  ],
  "paths": {
    "/profiles/{profileId}": {
      "put": {
        "tags": [
          "Profiles"
        ],
        "summary": "Commit a search profile",
        "parameters": [
          {
            "name": "x-if-hash-match",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "rebuildMode",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "auto",
                "full",
                "bypass"
              ]
            }
          },
          {
            "name": "profileId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 3,
              "maxLength": 64,
              "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$"
            }
          }
        ],
        "deprecated": false,
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "minLength": 3,
                    "maxLength": 64,
                    "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$"
                  },
                  "name": {
                    "type": "string",
                    "minLength": 1
                  },
                  "description": {
                    "type": "string"
                  },
                  "source": {
                    "oneOf": [
                      {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "const": "native-object"
                          },
                          "objectType": {
                            "type": "string",
                            "pattern": "^[a-z0-9_-]+"
                          },
                          "query": {
                            "type": "object",
                            "propertyNames": {
                              "type": "string"
                            },
                            "additionalProperties": {}
                          }
                        },
                        "required": [
                          "kind",
                          "objectType"
                        ],
                        "additionalProperties": false
                      }
                    ],
                    "type": "object"
                  },
                  "template": {
                    "type": "object",
                    "properties": {
                      "language": {
                        "type": "string",
                        "const": "handlebars"
                      },
                      "header": {
                        "type": "string"
                      },
                      "body": {
                        "type": "string",
                        "minLength": 1
                      }
                    },
                    "required": [
                      "language",
                      "body"
                    ],
                    "additionalProperties": false
                  },
                  "chunking": {
                    "type": "object",
                    "properties": {
                      "splitterId": {
                        "type": "string",
                        "enum": [
                          "plain-text-window"
                        ]
                      },
                      "size": {
                        "default": 1600,
                        "type": "integer",
                        "minimum": 100,
                        "maximum": 128000
                      },
                      "overlap": {
                        "default": 10,
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 50
                      },
                      "preserveBoundaries": {
                        "default": true,
                        "type": "boolean"
                      }
                    },
                    "required": [
                      "splitterId",
                      "size",
                      "overlap",
                      "preserveBoundaries"
                    ],
                    "additionalProperties": false
                  },
                  "embedding": {
                    "type": "object",
                    "properties": {
                      "model": {
                        "default": "voyage-4",
                        "type": "string",
                        "enum": [
                          "voyage-4-lite",
                          "voyage-4",
                          "voyage-4-large"
                        ]
                      },
                      "dimensions": {
                        "default": 1024,
                        "anyOf": [
                          {
                            "type": "number",
                            "const": 512
                          },
                          {
                            "type": "number",
                            "const": 1024
                          },
                          {
                            "type": "number",
                            "const": 2048
                          }
                        ]
                      }
                    },
                    "required": [
                      "model",
                      "dimensions"
                    ],
                    "additionalProperties": false
                  },
                  "projections": {
                    "default": [],
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "alias": {
                          "type": "string",
                          "pattern": "^[a-z][a-z0-9_]{0,62}$"
                        },
                        "language": {
                          "type": "string",
                          "enum": [
                            "jsonpath",
                            "jsonata"
                          ]
                        },
                        "expression": {
                          "type": "string",
                          "minLength": 1
                        },
                        "type": {
                          "type": "string",
                          "enum": [
                            "string",
                            "number",
                            "integer",
                            "boolean",
                            "datetime",
                            "string[]",
                            "number[]",
                            "integer[]"
                          ]
                        },
                        "retired": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "alias",
                        "language",
                        "expression",
                        "type"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "indexes": {
                    "default": [],
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "minLength": 2,
                          "maxLength": 64,
                          "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$"
                        },
                        "name": {
                          "type": "string",
                          "minLength": 1
                        },
                        "description": {
                          "type": "string"
                        },
                        "mode": {
                          "default": "hybrid",
                          "type": "string",
                          "enum": [
                            "semantic",
                            "hybrid"
                          ]
                        },
                        "topK": {
                          "default": 10,
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 100
                        },
                        "oneResultPerDocument": {
                          "default": true,
                          "type": "boolean"
                        },
                        "rerank": {
                          "default": {
                            "enabled": false,
                            "scope": "document"
                          },
                          "type": "object",
                          "properties": {
                            "enabled": {
                              "default": false,
                              "type": "boolean"
                            },
                            "presetId": {
                              "type": "string",
                              "minLength": 1
                            },
                            "topN": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "scope": {
                              "default": "document",
                              "type": "string",
                              "enum": [
                                "document",
                                "chunk"
                              ]
                            }
                          },
                          "required": [
                            "enabled",
                            "scope"
                          ],
                          "additionalProperties": false
                        },
                        "filters": {
                          "default": [],
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "static"
                              },
                              "field": {
                                "type": "string",
                                "minLength": 1
                              },
                              "op": {
                                "type": "string",
                                "enum": [
                                  "eq",
                                  "not-eq",
                                  "lt",
                                  "lte",
                                  "gt",
                                  "gte",
                                  "in",
                                  "not-in",
                                  "contains",
                                  "contains-any",
                                  "glob",
                                  "regex"
                                ]
                              },
                              "value": {}
                            },
                            "required": [
                              "kind",
                              "field",
                              "op",
                              "value"
                            ],
                            "additionalProperties": false
                          }
                        }
                      },
                      "required": [
                        "id",
                        "name",
                        "mode",
                        "topK",
                        "oneResultPerDocument",
                        "rerank",
                        "filters"
                      ],
                      "additionalProperties": false
                    }
                  }
                },
                "required": [
                  "id",
                  "name",
                  "source",
                  "template",
                  "chunking",
                  "embedding",
                  "projections",
                  "indexes"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SearchProfile"
                }
              }
            }
          },
          "400": {
            "description": "Invalid search profile or rebuild mode",
            "content": {}
          },
          "401": {
            "description": "Missing or invalid authorization header",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/$ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Invalid permissions",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/$ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Search profile not found",
            "content": {}
          },
          "409": {
            "description": "Commit lost a concurrent state transition",
            "content": {}
          },
          "412": {
            "description": "Profile hash no longer matches",
            "content": {}
          },
          "422": {
            "description": "Object type is immutable or bypass is not applicable to this change",
            "content": {}
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "jwt": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "JWT"
      }
    },
    "schemas": {
      "SearchProfile": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 3,
            "maxLength": 64,
            "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$"
          },
          "name": {
            "type": "string",
            "minLength": 1
          },
          "description": {
            "type": "string"
          },
          "source": {
            "oneOf": [
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "const": "native-object"
                  },
                  "objectType": {
                    "type": "string",
                    "pattern": "^[a-z0-9_-]+"
                  },
                  "query": {
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {}
                  }
                },
                "required": [
                  "kind",
                  "objectType"
                ],
                "additionalProperties": false
              }
            ],
            "type": "object"
          },
          "template": {
            "type": "object",
            "properties": {
              "language": {
                "type": "string",
                "const": "handlebars"
              },
              "header": {
                "type": "string"
              },
              "body": {
                "type": "string",
                "minLength": 1
              }
            },
            "required": [
              "language",
              "body"
            ],
            "additionalProperties": false
          },
          "chunking": {
            "type": "object",
            "properties": {
              "splitterId": {
                "type": "string",
                "enum": [
                  "plain-text-window"
                ]
              },
              "size": {
                "default": 1600,
                "type": "integer",
                "minimum": 100,
                "maximum": 128000
              },
              "overlap": {
                "default": 10,
                "type": "integer",
                "minimum": 0,
                "maximum": 50
              },
              "preserveBoundaries": {
                "default": true,
                "type": "boolean"
              }
            },
            "required": [
              "splitterId",
              "size",
              "overlap",
              "preserveBoundaries"
            ],
            "additionalProperties": false
          },
          "embedding": {
            "type": "object",
            "properties": {
              "model": {
                "default": "voyage-4",
                "type": "string",
                "enum": [
                  "voyage-4-lite",
                  "voyage-4",
                  "voyage-4-large"
                ]
              },
              "dimensions": {
                "default": 1024,
                "anyOf": [
                  {
                    "type": "number",
                    "const": 512
                  },
                  {
                    "type": "number",
                    "const": 1024
                  },
                  {
                    "type": "number",
                    "const": 2048
                  }
                ]
              }
            },
            "required": [
              "model",
              "dimensions"
            ],
            "additionalProperties": false
          },
          "projections": {
            "default": [],
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "alias": {
                  "type": "string",
                  "pattern": "^[a-z][a-z0-9_]{0,62}$"
                },
                "language": {
                  "type": "string",
                  "enum": [
                    "jsonpath",
                    "jsonata"
                  ]
                },
                "expression": {
                  "type": "string",
                  "minLength": 1
                },
                "type": {
                  "type": "string",
                  "enum": [
                    "string",
                    "number",
                    "integer",
                    "boolean",
                    "datetime",
                    "string[]",
                    "number[]",
                    "integer[]"
                  ]
                },
                "retired": {
                  "type": "boolean"
                }
              },
              "required": [
                "alias",
                "language",
                "expression",
                "type"
              ],
              "additionalProperties": false
            }
          },
          "indexes": {
            "default": [],
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 2,
                  "maxLength": 64,
                  "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$"
                },
                "name": {
                  "type": "string",
                  "minLength": 1
                },
                "description": {
                  "type": "string"
                },
                "mode": {
                  "default": "hybrid",
                  "type": "string",
                  "enum": [
                    "semantic",
                    "hybrid"
                  ]
                },
                "topK": {
                  "default": 10,
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 100
                },
                "oneResultPerDocument": {
                  "default": true,
                  "type": "boolean"
                },
                "rerank": {
                  "default": {
                    "enabled": false,
                    "scope": "document"
                  },
                  "type": "object",
                  "properties": {
                    "enabled": {
                      "default": false,
                      "type": "boolean"
                    },
                    "presetId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "topN": {
                      "type": "integer",
                      "exclusiveMinimum": 0,
                      "maximum": 9007199254740991
                    },
                    "scope": {
                      "default": "document",
                      "type": "string",
                      "enum": [
                        "document",
                        "chunk"
                      ]
                    }
                  },
                  "required": [
                    "enabled",
                    "scope"
                  ],
                  "additionalProperties": false
                },
                "filters": {
                  "default": [],
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "static"
                      },
                      "field": {
                        "type": "string",
                        "minLength": 1
                      },
                      "op": {
                        "type": "string",
                        "enum": [
                          "eq",
                          "not-eq",
                          "lt",
                          "lte",
                          "gt",
                          "gte",
                          "in",
                          "not-in",
                          "contains",
                          "contains-any",
                          "glob",
                          "regex"
                        ]
                      },
                      "value": {}
                    },
                    "required": [
                      "kind",
                      "field",
                      "op",
                      "value"
                    ],
                    "additionalProperties": false
                  }
                }
              },
              "required": [
                "id",
                "name",
                "mode",
                "topK",
                "oneResultPerDocument",
                "rerank",
                "filters"
              ],
              "additionalProperties": false
            }
          },
          "_metaData": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "createdAt": {
                "type": "string",
                "pattern": "^(?:\\d+(?:\\.\\d+?)?|(?:\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(?:\\.\\d+)?Z))$",
                "description": "An ISO 8601 date time string",
                "format": "date-time"
              },
              "updatedAt": {
                "type": "string",
                "pattern": "^(?:\\d+(?:\\.\\d+?)?|(?:\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(?:\\.\\d+)?Z))$",
                "description": "An ISO 8601 date time string",
                "format": "date-time"
              },
              "hash": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "createdAt"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "id",
          "name",
          "source",
          "template",
          "chunking",
          "embedding",
          "projections",
          "indexes",
          "_metaData"
        ],
        "additionalProperties": false
      },
      "$ErrorResponse": {
        "type": "object",
        "properties": {
          "code": {
            "type": [
              "string",
              "number"
            ]
          },
          "message": {
            "type": "string"
          },
          "errors": {
            "type": "array",
            "items": {}
          }
        },
        "required": [
          "code",
          "message"
        ],
        "additionalProperties": false
      }
    }
  }
}
```