> 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/infrastructure-as-code-management/iacm-api-reference/workspaces/list-resources-using-selectors.md).

# List resources using selectors

List resources for a workspace using selectors. Pagination is optional: when limit and page are omitted (or zero), all matching resources are returned for backward compatibility.

```json
{"openapi":"3.0.3","info":{"title":"Infrastructure as Code Management","version":"0.1.0"},"tags":[{"name":"workspaces","description":"Workspaces Service handles the API for managing workspaces\nand triggering workflows against them."}],"servers":[{"url":"http://localhost:80"}],"paths":{"/api/orgs/{org}/projects/{project}/workspaces/{identifier}/resources/search":{"post":{"tags":["workspaces"],"summary":"List resources using selectors","description":"List resources for a workspace using selectors. Pagination is optional: when limit and page are omitted (or zero), all matching resources are returned for backward compatibility.","operationId":"workspaces#search-resources","parameters":[{"name":"org","in":"path","description":"Org is the organisation identifier.","required":true,"schema":{"type":"string","description":"Org is the organisation identifier.","minLength":1,"maxLength":128}},{"name":"project","in":"path","description":"Project is the project identifier.","required":true,"schema":{"type":"string","description":"Project is the project identifier.","minLength":1,"maxLength":128}},{"name":"identifier","in":"path","description":"Workspace identifier","required":true,"schema":{"type":"string","description":"Workspace identifier"}},{"name":"Harness-Account","in":"header","description":"Account is the internal customer account ID.","allowEmptyValue":true,"required":true,"schema":{"type":"string","description":"Account is the internal customer account ID.","minLength":1,"maxLength":128}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SearchResourcesRequest"}}}},"responses":{"200":{"description":"OK response.","headers":{},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SearchResourcesResponse"}}}},"400":{"description":"BadRequestError: Bad Request response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/SearchResourcesResponse"}}}},"401":{"description":"UnauthorizedError: Unauthorized response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"ForbiddenError: Forbidden response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"NotFoundError: Not Found response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}},"408":{"description":"TimeoutError: Request Timeout response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"ConflictError: Conflict response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}},"423":{"description":"LockedError: Locked response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}},"499":{"description":"ContextCancelledError:  response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"InternalServerError: Internal Server Error response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"BadGatewayError: Bad Gateway response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}},"components":{"schemas":{"SearchResourcesRequest":{"type":"object","properties":{"limit":{"type":"integer","description":"Limit is the number of records to return for a page. When omitted, all records are returned.","format":"int64","minimum":1,"maximum":1000},"page":{"type":"integer","description":"Page is the page number to return relative to the page 'limit'. When omitted, all records are returned.","format":"int64","minimum":1},"selectors":{"type":"array","items":{"$ref":"#/components/schemas/ResourcesSelector"}}}},"ResourcesSelector":{"type":"object","properties":{"include_conditions":{"type":"array","items":{"$ref":"#/components/schemas/ResourcesSelectorConditions"},"description":"The conditions to include the resource."},"path_id":{"type":"string","description":"Path identifier to filter resources by"},"provider":{"type":"string","description":"Provider Type to filter resources by"},"resource_type":{"type":"string","description":"Type is the type of resource to select."},"search_text":{"type":"string","description":"Search resources by text string"}}},"ResourcesSelectorConditions":{"type":"object","properties":{"attribute":{"type":"string","description":"Attribute is the attribute to select on."},"operator":{"type":"string","description":"Operator is the operator to use for the selector.","enum":["equals","not_equals","contains","not_contains","starts_with","ends_with"]},"value":{"type":"string","description":"Value is the value to check."}},"required":["attribute","operator","value"]},"SearchResourcesResponse":{"type":"object","properties":{"data_sources":{"$ref":"#/components/schemas/ResourceCollection"},"outputs":{"$ref":"#/components/schemas/OutputCollection"},"resources":{"$ref":"#/components/schemas/ResourceCollection"},"stack_outputs":{"type":"object","description":"Outputs grouped by stack path for Terragrunt workspaces","additionalProperties":{"$ref":"#/components/schemas/OutputCollection"}},"total_resources":{"type":"integer","description":"Total number of resources managed by this workspace","default":0,"format":"int64"}},"required":["resources","data_sources","outputs","total_resources"]},"ResourceCollection":{"type":"array","items":{"$ref":"#/components/schemas/HarnessIacmResource"}},"HarnessIacmResource":{"type":"object","properties":{"attributes":{"type":"object","description":"A map of values related to the resource","additionalProperties":true},"createdAt":{"type":"integer","description":"Timestamp when the resource was created.","format":"int64"},"drift_attributes":{"type":"object","description":"A map of values related to the resource","additionalProperties":true},"drift_status":{"type":"string","description":"Indicates if this resource is experiencing drift.","enum":["changed","deleted","unchanged"]},"lastSyncedAt":{"type":"integer","description":"Timestamp when the resource was last updated.","format":"int64"},"mode":{"type":"string","description":"Mode associated with the resource.","enum":["resource","data","output"]},"module":{"type":"string","description":"Module associated with the resource."},"monthly_cost":{"type":"number","description":"Current period cost from CCM (null if no cost data).","format":"double"},"monthly_saving":{"type":"number","description":"Monthly potential saving from CCM (null if no cost data).","format":"double"},"name":{"type":"string","description":"Name associated with the resource."},"path_id":{"type":"string","description":"Path associated with the resource. Could be namespace, environment or stack id."},"provider":{"type":"string","description":"Cloud provider associated with the resource."},"recommendation_count":{"type":"integer","description":"Number of CCM recommendations for this resource (null if no cost data).","format":"int64"},"resource_id":{"type":"string","description":"Unique identifier for the resource from the cloud provider."},"sensitive_attributes":{"type":"array","items":{},"description":"A list of the sensitive attribute keys "},"type":{"type":"string","description":"Type of the provisioned resource."}},"description":"Represents an individual provisioned resource.","required":["provider","type","name","module","mode","path_id","resource_id","attributes","drift_status","drift_attributes","sensitive_attributes"]},"OutputCollection":{"type":"array","items":{"$ref":"#/components/schemas/HarnessIacmOutput"}},"HarnessIacmOutput":{"type":"object","properties":{"expression":{"type":"string","description":"JEXL expression for dynamic output resolution"},"name":{"type":"string","description":"Name associated with the output."},"sensitive":{"type":"boolean","description":"Indicates whether this value is sensitive"},"stack_path":{"type":"string","description":"Stack path for Terragrunt workspaces"},"value":{"type":"string","description":"Value associated with the output."}},"description":"Represents an individual output variable.","required":["name","value","sensitive"]},"Error":{"type":"object","properties":{"fault":{"type":"boolean","description":"Is the error a server-side fault?"},"id":{"type":"string","description":"ID is a unique identifier for this particular occurrence of the problem."},"message":{"type":"string","description":"Message is a human-readable explanation specific to this occurrence of the problem."},"name":{"type":"string","description":"Name is the name of this class of errors."},"temporary":{"type":"boolean","description":"Is the error temporary?"},"timeout":{"type":"boolean","description":"Is the error a timeout?"}},"required":["name","id","message","temporary","timeout","fault"]}}}}
```
