---
title: "CreateSegmentIndexRequest"
method: POST
path: "/v1/namespaces/{tenant_meta.namespace}/segment-index-request"
tags: ["SegmentIndexRequestService"]
---

# CreateSegmentIndexRequest

`POST /v1/namespaces/{tenant_meta.namespace}/segment-index-request`

## Request

- Base URL: `https://api.endorlabs.com`
- URL: `https://api.endorlabs.com/v1/namespaces/{tenant_meta.namespace}/segment-index-request`
- Auth: none declared

Creates a segment index request.

## Path parameters

- `tenant_meta.namespace` string, required

## Request body

- SegmentIndexRequestServiceCreateSegmentIndexRequestBody: A segment index request allows the caller to provide a set of code segments with their associated metadata that should be indexed as part the embeddings store. Embeddings are only created. They are only read through the SegmentQueryRequest. The request can include multiple segments to allow parallel execution.
  - `context` V1Context: Contexts keep objects from different scans separated.
    - `id` string, required: The context ID, such as a pull request ID or branch reference.
    - `tags` string[]: A list of tags applied to a context. Used primarily for CI and SBOM contexts.
    - `type` 'CONTEXT_TYPE_UNSPECIFIED' | 'CONTEXT_TYPE_MAIN' | 'CONTEXT_TYPE_EXTERNAL' | 'CONTEXT_TYPE_CI_RUN' | 'CONTEXT_TYPE_SBOM' | 'CONTEXT_TYPE_REF', required: - CONTEXT_TYPE_MAIN: Objects from a scan of the default branch. All objects in the oss namespace are in the main context. The context id is always "default". - CONTEXT_TYPE_EXTERNAL: Indicates that this object is a copy/temporary value of an object in another project. Used for same-tenant dependencies. In source code reference this is equivalent to "vendor" folders. Package versions in the external context are only scanned for call graphs. No other operations are performed on them. - CONTEXT_TYPE_CI_RUN: Objects from a PR scan. The context id is the PR UUID. Objects in this context are deleted after 30 days. - CONTEXT_TYPE_SBOM: Objects from an SBOM scan. The context id is the SBOM serial number or some other unique identifier. - CONTEXT_TYPE_REF: Objects from a scan of a specific branch. The context id is the branch reference name.
    - `will_be_deleted_at` string, date-time: Time that all objects in this context will be deleted. This field is deprecated and will be removed in the future. Please use the meta.will_be_deleted_at field instead.
  - `meta` V1Meta, required: Common fields for all Endor Labs resources.
    - `annotations` object: Annotations can be used to attach metadata to a resource message. Annotation values can be small or large, structured or unstructured, and may include characters not permitted by labels. The keys may contain alphanumerics, underscores (_), dots (.) and dashes (-). The values of an annotation must be 16384 bytes or smaller.
    - `create_time` string, date-time: Time the resource was created. Format: 2017-01-15T01:30:15.01Z RFC 3339: https://www.ietf.org/rfc/rfc3339.txt.
    - `created_by` string: Name and authentication source of the user who created the object, for example, ewok@endor.ai@google@api-key.
    - `description` string: Resource description. Must be less than 1024 bytes.
    - `index_data` V1IndexData: IndexData is used to index the resource for search. It's an internal object.
      - `data` string[]
      - `search_score` number, float: search_score is the score of the resource for search. Internal use only.
      - `tenant` string
      - `will_be_deleted_at` string, date-time: Time that the resource will be deleted.
    - `kind` string: Resource kind, for example, HelloResponse. Auto-generated using the protobuf message proto.MessageName().Name().
    - `name` string, required: Resource name. Must be 63 characters or less.
    - `parent_kind` string: Parent object resource kind, for example, Project.
    - `parent_uuid` string: Parent object UUID.
    - `references` object: Map of objects referenced in a query API.
    - `tags` string[]: List of tags attached to the resource. Tags can be used to select objects and to find collections of objects that satisfy certain conditions. A tag must be 255 characters or less.
    - `update_time` string, date-time: Time the resource was last updated. Note: Updated on all create/patch/delete operations. Format: 2017-01-15T01:30:15.01Z RFC 3339: https://www.ietf.org/rfc/rfc3339.txt.
    - `updated_by` string: Name and authentication source of the last user who updated the object, for example, vulnerabilityingestor@endor.ai@x509.
    - `upsert_time` string, date-time: Time the resource was last upserted. Note: create_time is only set the first time the resource is created. upsert_time is set every time the resource is upseted. Format: 2017-01-15T01:30:15.01Z RFC 3339: https://www.ietf.org/rfc/rfc3339.txt.
    - `version` string: Message version.
  - `spec` V1SegmentIndexRequestSpec, required
    - `function_summary_prompt_version` integer: Prompt schema version the server currently requires for function summaries.
    - `generate_embeddings` boolean: Whether the client wants embedding vectors computed for the segments in this request. Defaults to true when unset, so a client sent before this field existed keeps its current embedding behavior; only an explicit false skips embedding generation.
    - `nearest_tag` string: Closest version tag reachable through the parents of the indexed commit, when that commit is not itself a tagged version. Unset otherwise. The server stores it so that a match on the commit can be reported under this tag.
    - `project_uuid` string: Project UUID.
    - `ref` string: Resolved ref of the source control version.
    - `segmentation_done` boolean: Set to true for the last index request for the source control version.
    - `segmentation_starting` boolean: Set to true for the first index request for the source control version.
    - `segmenter_version` integer
    - `segments` V1Segment[]: List of segments to index.
      - `annotations` object: Extensibility field of additonal metadata that we might want to carry with the segment.
      - `blame_time` string, date-time: Git blame time of this segment.
      - `commit_time` string, date-time: Time of the repo version that this segment belongs to.
      - `content` string, byte: Content of the segment.
      - `cyclomatic_complexity` integer: CyclomaticComplexity represents the complexity of the control flow.
      - `file_hash` string, byte: SHA256 for the file that contains this segment.
      - `function_ref` string: Function signature of the segment.
      - `has_summary` boolean: Set by the server response to indicate this segment already has a usable function summary, so the client does not need to summarize it.
      - `language` 'LANGUAGE_UNSPECIFIED' | 'LANGUAGE_GO' | 'LANGUAGE_JAVA' | 'LANGUAGE_SCALA' | 'LANGUAGE_PYTHON' | 'LANGUAGE_RUST' | 'LANGUAGE_JS' | 'LANGUAGE_RUBY' | 'LANGUAGE_CSHARP' | 'LANGUAGE_PHP' | 'LANGUAGE_TYPESCRIPT' | 'LANGUAGE_KOTLIN' | 'LANGUAGE_SWIFT' | 'LANGUAGE_OBJECTIVEC' | 'LANGUAGE_C' | 'LANGUAGE_CPP' | 'LANGUAGE_SWIFTURL' | 'LANGUAGE_CONAN' | 'LANGUAGE_GOSU': - LANGUAGE_GOSU: Gosu, a JVM language used by Guidewire applications.
      - `line_end` integer: The last line of the segment.
      - `line_start` integer: The first line of the segment.
      - `metadata` V1SegmentMetadata
        - `code_size` string, int64: Size of code for this segment.
        - `content_kind` 'SEGMENT_CONTENT_KIND_UNSPECIFIED' | 'SEGMENT_CONTENT_KIND_FUNCTION' | 'SEGMENT_CONTENT_KIND_TYPE' | 'SEGMENT_CONTENT_KIND_LICENSE': SegmentContentKind is the kind of the segment.
        - `embedding` V1EmbeddingVector: Embedding vector for one code segment.
          - `vector` number[]
        - `signature` string: Signature for this segment.
      - `package_version` string: Canonical representation of the version of the package following all our conventions about package URLs. For example, "c://github.com/my/repo@v1.2.3".
      - `path` string: Relative path of the file where this segment was found.
      - `rest` boolean: Flag to indicate the segment is a REST segment.
      - `sha` string: Commit sha of the segment.
      - `source_uri` string: Source of this segment.
    - `sha` string: SHA of the source control version.
    - `summaries` SegmentIndexRequestFunctionSummaryReport[]: Function summaries the client computed for segments in this request that the server reported as missing one (see Segment.has_summary).
      - `data_flow` string: Description of data flow through the function.
      - `hash` string, required: Segment signature hash this summary belongs to, matching the corresponding Segment.metadata.signature in this request.
      - `is_critical_api` boolean: Whether the function is itself a security-critical API.
      - `is_entry_point` boolean: Whether the function is an application entry point.
      - `is_sanitizer` boolean: Whether the function sanitizes untrusted data.
      - `is_sink` boolean: Whether the function consumes data in a security-sensitive operation.
      - `is_source` boolean: Whether the function introduces untrusted data.
      - `is_trivial` boolean: Whether the function is classified as trivial.
      - `keywords` string[]: Searchable concepts associated with the function.
      - `language` 'LANGUAGE_UNSPECIFIED' | 'LANGUAGE_GO' | 'LANGUAGE_JAVA' | 'LANGUAGE_SCALA' | 'LANGUAGE_PYTHON' | 'LANGUAGE_RUST' | 'LANGUAGE_JS' | 'LANGUAGE_RUBY' | 'LANGUAGE_CSHARP' | 'LANGUAGE_PHP' | 'LANGUAGE_TYPESCRIPT' | 'LANGUAGE_KOTLIN' | 'LANGUAGE_SWIFT' | 'LANGUAGE_OBJECTIVEC' | 'LANGUAGE_C' | 'LANGUAGE_CPP' | 'LANGUAGE_SWIFTURL' | 'LANGUAGE_CONAN' | 'LANGUAGE_GOSU', required: - LANGUAGE_GOSU: Gosu, a JVM language used by Guidewire applications.
      - `model` string, required: AI model that produced the summary.
      - `postconditions` string[]: Conditions expected to hold after the function executes.
      - `preconditions` string[]: Conditions expected to hold before the function executes.
      - `prompt_version` integer, required: Prompt schema version that produced the summary.
      - `rest_path` string: REST route associated with an entry-point function.
      - `sanitizes_for` string[]: Vulnerability classes mitigated by the function.
      - `summary` string: Human-readable description of the function behavior.
      - `uses_critical_api` boolean: Whether the function invokes a security-critical API.
    - `summary_done` boolean: Set by the server response to indicate every function segment indexed for this source control version already has a usable summary, so the client does not need to summarize any of them.
  - `tenant_meta` object: Namespace of the segment index request.
  - `uuid` string: The UUID of the segment index request.

## Response `200`

A successful response.

- V1SegmentIndexRequest: A segment index request allows the caller to provide a set of code segments with their associated metadata that should be indexed as part the embeddings store. Embeddings are only created. They are only read through the SegmentQueryRequest. The request can include multiple segments to allow parallel execution.
  - `context` V1Context: Contexts keep objects from different scans separated.
    - `id` string, required: The context ID, such as a pull request ID or branch reference.
    - `tags` string[]: A list of tags applied to a context. Used primarily for CI and SBOM contexts.
    - `type` 'CONTEXT_TYPE_UNSPECIFIED' | 'CONTEXT_TYPE_MAIN' | 'CONTEXT_TYPE_EXTERNAL' | 'CONTEXT_TYPE_CI_RUN' | 'CONTEXT_TYPE_SBOM' | 'CONTEXT_TYPE_REF', required: - CONTEXT_TYPE_MAIN: Objects from a scan of the default branch. All objects in the oss namespace are in the main context. The context id is always "default". - CONTEXT_TYPE_EXTERNAL: Indicates that this object is a copy/temporary value of an object in another project. Used for same-tenant dependencies. In source code reference this is equivalent to "vendor" folders. Package versions in the external context are only scanned for call graphs. No other operations are performed on them. - CONTEXT_TYPE_CI_RUN: Objects from a PR scan. The context id is the PR UUID. Objects in this context are deleted after 30 days. - CONTEXT_TYPE_SBOM: Objects from an SBOM scan. The context id is the SBOM serial number or some other unique identifier. - CONTEXT_TYPE_REF: Objects from a scan of a specific branch. The context id is the branch reference name.
    - `will_be_deleted_at` string, date-time: Time that all objects in this context will be deleted. This field is deprecated and will be removed in the future. Please use the meta.will_be_deleted_at field instead.
  - `meta` V1Meta, required: Common fields for all Endor Labs resources.
    - `annotations` object: Annotations can be used to attach metadata to a resource message. Annotation values can be small or large, structured or unstructured, and may include characters not permitted by labels. The keys may contain alphanumerics, underscores (_), dots (.) and dashes (-). The values of an annotation must be 16384 bytes or smaller.
    - `create_time` string, date-time: Time the resource was created. Format: 2017-01-15T01:30:15.01Z RFC 3339: https://www.ietf.org/rfc/rfc3339.txt.
    - `created_by` string: Name and authentication source of the user who created the object, for example, ewok@endor.ai@google@api-key.
    - `description` string: Resource description. Must be less than 1024 bytes.
    - `index_data` V1IndexData: IndexData is used to index the resource for search. It's an internal object.
      - `data` string[]
      - `search_score` number, float: search_score is the score of the resource for search. Internal use only.
      - `tenant` string
      - `will_be_deleted_at` string, date-time: Time that the resource will be deleted.
    - `kind` string: Resource kind, for example, HelloResponse. Auto-generated using the protobuf message proto.MessageName().Name().
    - `name` string, required: Resource name. Must be 63 characters or less.
    - `parent_kind` string: Parent object resource kind, for example, Project.
    - `parent_uuid` string: Parent object UUID.
    - `references` object: Map of objects referenced in a query API.
    - `tags` string[]: List of tags attached to the resource. Tags can be used to select objects and to find collections of objects that satisfy certain conditions. A tag must be 255 characters or less.
    - `update_time` string, date-time: Time the resource was last updated. Note: Updated on all create/patch/delete operations. Format: 2017-01-15T01:30:15.01Z RFC 3339: https://www.ietf.org/rfc/rfc3339.txt.
    - `updated_by` string: Name and authentication source of the last user who updated the object, for example, vulnerabilityingestor@endor.ai@x509.
    - `upsert_time` string, date-time: Time the resource was last upserted. Note: create_time is only set the first time the resource is created. upsert_time is set every time the resource is upseted. Format: 2017-01-15T01:30:15.01Z RFC 3339: https://www.ietf.org/rfc/rfc3339.txt.
    - `version` string: Message version.
  - `spec` V1SegmentIndexRequestSpec, required
    - `function_summary_prompt_version` integer: Prompt schema version the server currently requires for function summaries.
    - `generate_embeddings` boolean: Whether the client wants embedding vectors computed for the segments in this request. Defaults to true when unset, so a client sent before this field existed keeps its current embedding behavior; only an explicit false skips embedding generation.
    - `nearest_tag` string: Closest version tag reachable through the parents of the indexed commit, when that commit is not itself a tagged version. Unset otherwise. The server stores it so that a match on the commit can be reported under this tag.
    - `project_uuid` string: Project UUID.
    - `ref` string: Resolved ref of the source control version.
    - `segmentation_done` boolean: Set to true for the last index request for the source control version.
    - `segmentation_starting` boolean: Set to true for the first index request for the source control version.
    - `segmenter_version` integer
    - `segments` V1Segment[]: List of segments to index.
      - `annotations` object: Extensibility field of additonal metadata that we might want to carry with the segment.
      - `blame_time` string, date-time: Git blame time of this segment.
      - `commit_time` string, date-time: Time of the repo version that this segment belongs to.
      - `content` string, byte: Content of the segment.
      - `cyclomatic_complexity` integer: CyclomaticComplexity represents the complexity of the control flow.
      - `file_hash` string, byte: SHA256 for the file that contains this segment.
      - `function_ref` string: Function signature of the segment.
      - `has_summary` boolean: Set by the server response to indicate this segment already has a usable function summary, so the client does not need to summarize it.
      - `language` 'LANGUAGE_UNSPECIFIED' | 'LANGUAGE_GO' | 'LANGUAGE_JAVA' | 'LANGUAGE_SCALA' | 'LANGUAGE_PYTHON' | 'LANGUAGE_RUST' | 'LANGUAGE_JS' | 'LANGUAGE_RUBY' | 'LANGUAGE_CSHARP' | 'LANGUAGE_PHP' | 'LANGUAGE_TYPESCRIPT' | 'LANGUAGE_KOTLIN' | 'LANGUAGE_SWIFT' | 'LANGUAGE_OBJECTIVEC' | 'LANGUAGE_C' | 'LANGUAGE_CPP' | 'LANGUAGE_SWIFTURL' | 'LANGUAGE_CONAN' | 'LANGUAGE_GOSU': - LANGUAGE_GOSU: Gosu, a JVM language used by Guidewire applications.
      - `line_end` integer: The last line of the segment.
      - `line_start` integer: The first line of the segment.
      - `metadata` V1SegmentMetadata
        - `code_size` string, int64: Size of code for this segment.
        - `content_kind` 'SEGMENT_CONTENT_KIND_UNSPECIFIED' | 'SEGMENT_CONTENT_KIND_FUNCTION' | 'SEGMENT_CONTENT_KIND_TYPE' | 'SEGMENT_CONTENT_KIND_LICENSE': SegmentContentKind is the kind of the segment.
        - `embedding` V1EmbeddingVector: Embedding vector for one code segment.
          - `vector` number[]
        - `signature` string: Signature for this segment.
      - `package_version` string: Canonical representation of the version of the package following all our conventions about package URLs. For example, "c://github.com/my/repo@v1.2.3".
      - `path` string: Relative path of the file where this segment was found.
      - `rest` boolean: Flag to indicate the segment is a REST segment.
      - `sha` string: Commit sha of the segment.
      - `source_uri` string: Source of this segment.
    - `sha` string: SHA of the source control version.
    - `summaries` SegmentIndexRequestFunctionSummaryReport[]: Function summaries the client computed for segments in this request that the server reported as missing one (see Segment.has_summary).
      - `data_flow` string: Description of data flow through the function.
      - `hash` string, required: Segment signature hash this summary belongs to, matching the corresponding Segment.metadata.signature in this request.
      - `is_critical_api` boolean: Whether the function is itself a security-critical API.
      - `is_entry_point` boolean: Whether the function is an application entry point.
      - `is_sanitizer` boolean: Whether the function sanitizes untrusted data.
      - `is_sink` boolean: Whether the function consumes data in a security-sensitive operation.
      - `is_source` boolean: Whether the function introduces untrusted data.
      - `is_trivial` boolean: Whether the function is classified as trivial.
      - `keywords` string[]: Searchable concepts associated with the function.
      - `language` 'LANGUAGE_UNSPECIFIED' | 'LANGUAGE_GO' | 'LANGUAGE_JAVA' | 'LANGUAGE_SCALA' | 'LANGUAGE_PYTHON' | 'LANGUAGE_RUST' | 'LANGUAGE_JS' | 'LANGUAGE_RUBY' | 'LANGUAGE_CSHARP' | 'LANGUAGE_PHP' | 'LANGUAGE_TYPESCRIPT' | 'LANGUAGE_KOTLIN' | 'LANGUAGE_SWIFT' | 'LANGUAGE_OBJECTIVEC' | 'LANGUAGE_C' | 'LANGUAGE_CPP' | 'LANGUAGE_SWIFTURL' | 'LANGUAGE_CONAN' | 'LANGUAGE_GOSU', required: - LANGUAGE_GOSU: Gosu, a JVM language used by Guidewire applications.
      - `model` string, required: AI model that produced the summary.
      - `postconditions` string[]: Conditions expected to hold after the function executes.
      - `preconditions` string[]: Conditions expected to hold before the function executes.
      - `prompt_version` integer, required: Prompt schema version that produced the summary.
      - `rest_path` string: REST route associated with an entry-point function.
      - `sanitizes_for` string[]: Vulnerability classes mitigated by the function.
      - `summary` string: Human-readable description of the function behavior.
      - `uses_critical_api` boolean: Whether the function invokes a security-critical API.
    - `summary_done` boolean: Set by the server response to indicate every function segment indexed for this source control version already has a usable summary, so the client does not need to summarize any of them.
  - `tenant_meta` V1TenantMeta: Tenant related data for the tenant containing the resource.
    - `namespace` string, required: Namespaces are a way to organize organizational units into virtual groupings of resources. Namespaces must be a fully qualified name, for example, the child namespace of namespace "endor.prod" called "app" is called "endor.prod.app".
  - `uuid` string: The UUID of the segment index request.

## Other responses

- `default`: An unexpected error response.

## Changes

- **2026-11-03** `4acd9fe15140`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/endorlabs/apis/endor-labs-rest-api-reference/changes/v1/namespaces/:tenant_meta.namespace/segment-index-request/post.md)

---

[API](https://skmtc.dev/endorlabs/apis/endor-labs-rest-api-reference.md) - [All operations](https://skmtc.dev/endorlabs/apis/endor-labs-rest-api-reference/llms.txt) - [OpenAPI document](https://skmtc.dev/endorlabs/apis/endor-labs-rest-api-reference/revisions/9c1a64674369?raw)
