# Caches

## List Caches

> Retrieves a paginated list of caches. Can be filtered by \`flow\_id\`, \`for\_flow\`, \`scope\`, and \`name\`.

```json
{"openapi":"3.0.0","info":{"title":"Patchworks Core API","version":"1.0.0"},"tags":[{"name":"Caches"}],"servers":[{"url":"https://core.wearepatchworks.com"}],"security":[{"ApiKeyAuth":[]},{"BearerAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"Authorization","description":"API key passed in the Authorization header. Format: `<api-key>`"},"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"OAuth 2 Bearer token obtained from POST /fabric/api/login"}},"schemas":{"CachesListResponse":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Caches"}},"meta":{"$ref":"#/components/schemas/PaginationMeta"},"links":{"$ref":"#/components/schemas/PaginationLinks"}}},"Caches":{"type":"object","properties":{"id":{"type":"integer","description":"Unique identifier"},"scope":{"type":"string"},"ttl":{"type":"string"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"name":{"type":"string"},"flow_id":{"type":"integer"},"cache_template_id":{"type":"integer"},"content":{"type":"string"},"ttl_unit":{"type":"string"},"ttl_number":{"type":"string"},"flow":{"type":"string"}}},"PaginationMeta":{"type":"object","properties":{"current_page":{"type":"integer"},"from":{"type":"integer","nullable":true},"last_page":{"type":"integer"},"path":{"type":"string"},"per_page":{"type":"integer"},"to":{"type":"integer","nullable":true},"total":{"type":"integer"}}},"PaginationLinks":{"type":"object","properties":{"first":{"type":"string","format":"uri"},"last":{"type":"string","format":"uri"},"prev":{"type":"string","format":"uri","nullable":true},"next":{"type":"string","format":"uri","nullable":true}}}}},"paths":{"/api/v1/caches":{"get":{"summary":"List Caches","description":"Retrieves a paginated list of caches. Can be filtered by `flow_id`, `for_flow`, `scope`, and `name`.","parameters":[{"name":"filter[flow_id]","in":"query","required":false,"schema":{"type":"string"},"description":"Filter results by flow_id."},{"name":"filter[for_flow]","in":"query","required":false,"schema":{"type":"string"},"description":"Filter results by for_flow."},{"name":"filter[scope]","in":"query","required":false,"schema":{"type":"string"},"description":"Filter results by scope."},{"name":"filter[id]","in":"query","required":false,"schema":{"type":"string"},"description":"Filter results by id."},{"name":"filter[,]","in":"query","required":false,"schema":{"type":"string"},"description":"Filter results by ,."},{"name":"filter[name]","in":"query","required":false,"schema":{"type":"string"},"description":"Filter results by name."},{"name":"filter[LIKE]","in":"query","required":false,"schema":{"type":"string"},"description":"Filter results by LIKE."},{"name":"filter[flow]","in":"query","required":false,"schema":{"type":"string"},"description":"Filter results by flow."},{"name":"include","in":"query","required":false,"schema":{"type":"string"},"description":"Comma-separated list of relationships to include. Available: flow"},{"name":"page","in":"query","required":false,"schema":{"type":"integer","minimum":1,"default":1},"description":"Page number for pagination."},{"name":"per_page","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100},"description":"Number of results per page."}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CachesListResponse"}}}},"401":{"description":"Unauthenticated"},"403":{"description":"Unauthorized"}},"tags":["Caches"]}}}}
```

## Get Metadata

> Retrieves information about caches used in flows.

```json
{"openapi":"3.0.0","info":{"title":"Patchworks Core API","version":"1.0.0"},"tags":[{"name":"Caches"}],"servers":[{"url":"https://core.wearepatchworks.com"}],"security":[{"ApiKeyAuth":[]},{"BearerAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"Authorization","description":"API key passed in the Authorization header. Format: `<api-key>`"},"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"OAuth 2 Bearer token obtained from POST /fabric/api/login"}}},"paths":{"/api/v1/caches/metadata":{"get":{"summary":"Get Metadata","description":"Retrieves information about caches used in flows.","tags":["Caches"],"responses":{"200":{"description":"Successful response","content":{"application/json":{}}},"401":{"description":"Unauthenticated"},"403":{"description":"Unauthorized"}},"parameters":[]}}}}
```

## Get Cache

> Retrieves the details of a specific cache.

```json
{"openapi":"3.0.0","info":{"title":"Patchworks Core API","version":"1.0.0"},"tags":[{"name":"Caches"}],"servers":[{"url":"https://core.wearepatchworks.com"}],"security":[{"ApiKeyAuth":[]},{"BearerAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"Authorization","description":"API key passed in the Authorization header. Format: `<api-key>`"},"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"OAuth 2 Bearer token obtained from POST /fabric/api/login"}},"schemas":{"CachesResponse":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Caches"}}},"Caches":{"type":"object","properties":{"id":{"type":"integer","description":"Unique identifier"},"scope":{"type":"string"},"ttl":{"type":"string"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"name":{"type":"string"},"flow_id":{"type":"integer"},"cache_template_id":{"type":"integer"},"content":{"type":"string"},"ttl_unit":{"type":"string"},"ttl_number":{"type":"string"},"flow":{"type":"string"}}}}},"paths":{"/api/v1/caches/{cache}":{"get":{"summary":"Get Cache","description":"Retrieves the details of a specific cache.","parameters":[{"name":"cache","in":"path","required":true,"schema":{"type":"string"},"description":"The cache identifier."},{"name":"filter[flow_id]","in":"query","required":false,"schema":{"type":"string"},"description":"Filter results by flow_id."},{"name":"filter[for_flow]","in":"query","required":false,"schema":{"type":"string"},"description":"Filter results by for_flow."},{"name":"filter[scope]","in":"query","required":false,"schema":{"type":"string"},"description":"Filter results by scope."},{"name":"filter[id]","in":"query","required":false,"schema":{"type":"string"},"description":"Filter results by id."},{"name":"filter[,]","in":"query","required":false,"schema":{"type":"string"},"description":"Filter results by ,."},{"name":"filter[name]","in":"query","required":false,"schema":{"type":"string"},"description":"Filter results by name."},{"name":"filter[LIKE]","in":"query","required":false,"schema":{"type":"string"},"description":"Filter results by LIKE."},{"name":"filter[flow]","in":"query","required":false,"schema":{"type":"string"},"description":"Filter results by flow."},{"name":"include","in":"query","required":false,"schema":{"type":"string"},"description":"Comma-separated list of relationships to include. Available: flow"},{"name":"page","in":"query","required":false,"schema":{"type":"integer","minimum":1,"default":1},"description":"Page number for pagination."},{"name":"per_page","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100},"description":"Number of results per page."}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CachesResponse"}}}},"401":{"description":"Unauthenticated"},"403":{"description":"Unauthorized"}},"tags":["Caches"]}}}}
```

## Update Cache

> Updates an existing cache.

```json
{"openapi":"3.0.0","info":{"title":"Patchworks Core API","version":"1.0.0"},"tags":[{"name":"Caches"}],"servers":[{"url":"https://core.wearepatchworks.com"}],"security":[{"ApiKeyAuth":[]},{"BearerAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"Authorization","description":"API key passed in the Authorization header. Format: `<api-key>`"},"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"OAuth 2 Bearer token obtained from POST /fabric/api/login"}},"schemas":{"CachesResponse":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Caches"}}},"Caches":{"type":"object","properties":{"id":{"type":"integer","description":"Unique identifier"},"scope":{"type":"string"},"ttl":{"type":"string"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"name":{"type":"string"},"flow_id":{"type":"integer"},"cache_template_id":{"type":"integer"},"content":{"type":"string"},"ttl_unit":{"type":"string"},"ttl_number":{"type":"string"},"flow":{"type":"string"}}},"ErrorResponse":{"type":"object","properties":{"message":{"type":"string"},"errors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}}}},"CachesUpdateRequest":{"type":"object","properties":{"ttl_unit":{"type":"string","nullable":true},"ttl_number":{"type":"string","nullable":true},"name":{"type":"string"}},"required":["name"]}}},"paths":{"/api/v1/caches/{cache}":{"put":{"summary":"Update Cache","description":"Updates an existing cache.","parameters":[{"name":"cache","in":"path","required":true,"schema":{"type":"string"},"description":"The cache identifier."}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CachesResponse"}}}},"401":{"description":"Unauthenticated"},"403":{"description":"Unauthorized"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CachesUpdateRequest"}}}},"tags":["Caches"]}}}}
```

## Delete Cache

> Permanently deletes a specific cache.

```json
{"openapi":"3.0.0","info":{"title":"Patchworks Core API","version":"1.0.0"},"tags":[{"name":"Caches"}],"servers":[{"url":"https://core.wearepatchworks.com"}],"security":[{"ApiKeyAuth":[]},{"BearerAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"Authorization","description":"API key passed in the Authorization header. Format: `<api-key>`"},"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"OAuth 2 Bearer token obtained from POST /fabric/api/login"}},"schemas":{"MessageResponse":{"type":"object","properties":{"message":{"type":"string"}}}}},"paths":{"/api/v1/caches/{cache}":{"delete":{"summary":"Delete Cache","description":"Permanently deletes a specific cache.","parameters":[{"name":"cache","in":"path","required":true,"schema":{"type":"string"},"description":"The cache identifier."}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageResponse"}}}},"401":{"description":"Unauthenticated"},"403":{"description":"Unauthorized"}},"tags":["Caches"]}}}}
```

## Get Content

> Retrieves data for a given cache key.

```json
{"openapi":"3.0.0","info":{"title":"Patchworks Core API","version":"1.0.0"},"tags":[{"name":"Caches"}],"servers":[{"url":"https://core.wearepatchworks.com"}],"security":[{"ApiKeyAuth":[]},{"BearerAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"Authorization","description":"API key passed in the Authorization header. Format: `<api-key>`"},"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"OAuth 2 Bearer token obtained from POST /fabric/api/login"}}},"paths":{"/api/v1/caches/{cache}/content/{key}":{"get":{"summary":"Get Content","description":"Retrieves data for a given cache key.","tags":["Caches"],"parameters":[{"name":"cache","in":"path","required":true,"schema":{"type":"string"},"description":"The cache identifier."},{"name":"key","in":"path","required":true,"schema":{"type":"string"},"description":"The key identifier."}],"responses":{"200":{"description":"Successful response"},"401":{"description":"Unauthenticated"},"403":{"description":"Unauthorized"}}}}}}
```

## Update Cache Content

> Updates the content for a given cache key.

```json
{"openapi":"3.0.0","info":{"title":"Patchworks Core API","version":"1.0.0"},"tags":[{"name":"Caches"}],"servers":[{"url":"https://core.wearepatchworks.com"}],"security":[{"ApiKeyAuth":[]},{"BearerAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"Authorization","description":"API key passed in the Authorization header. Format: `<api-key>`"},"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"OAuth 2 Bearer token obtained from POST /fabric/api/login"}},"schemas":{"CachesResponse":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Caches"}}},"Caches":{"type":"object","properties":{"id":{"type":"integer","description":"Unique identifier"},"scope":{"type":"string"},"ttl":{"type":"string"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"name":{"type":"string"},"flow_id":{"type":"integer"},"cache_template_id":{"type":"integer"},"content":{"type":"string"},"ttl_unit":{"type":"string"},"ttl_number":{"type":"string"},"flow":{"type":"string"}}},"ErrorResponse":{"type":"object","properties":{"message":{"type":"string"},"errors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}}}},"CachesUpdateContentRequest":{"type":"object","properties":{"content":{"type":"string","nullable":true}}}}},"paths":{"/api/v1/caches/{cache}/content/{key}":{"put":{"summary":"Update Cache Content","description":"Updates the content for a given cache key.","parameters":[{"name":"cache","in":"path","required":true,"schema":{"type":"string"},"description":"The cache identifier."},{"name":"key","in":"path","required":true,"schema":{"type":"string"},"description":"The key identifier."}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CachesResponse"}}}},"401":{"description":"Unauthenticated"},"403":{"description":"Unauthorized"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CachesUpdateContentRequest"}}}},"tags":["Caches"]}}}}
```

## Flush Cache

> Flushes the contents of a specific cache.

```json
{"openapi":"3.0.0","info":{"title":"Patchworks Core API","version":"1.0.0"},"tags":[{"name":"Caches"}],"servers":[{"url":"https://core.wearepatchworks.com"}],"security":[{"ApiKeyAuth":[]},{"BearerAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"Authorization","description":"API key passed in the Authorization header. Format: `<api-key>`"},"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"OAuth 2 Bearer token obtained from POST /fabric/api/login"}},"schemas":{"ErrorResponse":{"type":"object","properties":{"message":{"type":"string"},"errors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}}}}}},"paths":{"/api/v1/caches/{cache}/flush":{"post":{"summary":"Flush Cache","description":"Flushes the contents of a specific cache.","parameters":[{"name":"cache","in":"path","required":true,"schema":{"type":"string"},"description":"The cache identifier."}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthenticated"},"403":{"description":"Unauthorized"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"tags":["Caches"]}}}}
```

## Search Cache

> Searches key names, page numbers, and unique keys within a specific cache for a given term.

```json
{"openapi":"3.0.0","info":{"title":"Patchworks Core API","version":"1.0.0"},"tags":[{"name":"Caches"}],"servers":[{"url":"https://core.wearepatchworks.com"}],"security":[{"ApiKeyAuth":[]},{"BearerAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"Authorization","description":"API key passed in the Authorization header. Format: `<api-key>`"},"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"OAuth 2 Bearer token obtained from POST /fabric/api/login"}}},"paths":{"/api/v1/caches/{cache}/search/{search}":{"get":{"summary":"Search Cache","description":"Searches key names, page numbers, and unique keys within a specific cache for a given term.","parameters":[{"name":"cache","in":"path","required":true,"schema":{"type":"string"},"description":"The cache identifier."},{"name":"search","in":"path","required":true,"schema":{"type":"string"},"description":"The search identifier."}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthenticated"},"403":{"description":"Unauthorized"}},"tags":["Caches"]}}}}
```
