# Packages

## Get Flow Version Deployment Package

> Retrieves a paginated list of packages that have been deployed to at least one virtual environment.

```json
{"openapi":"3.0.0","info":{"title":"Patchworks Core API","version":"1.0.0"},"tags":[{"name":"Packages"}],"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/flow-version-deployments/packages":{"get":{"summary":"Get Flow Version Deployment Package","description":"Retrieves a paginated list of packages that have been deployed to at least one virtual environment.","tags":["Packages"],"parameters":[{"name":"filter[name]","in":"query","required":false,"schema":{"type":"string"},"description":"Filter results by name."},{"name":"include","in":"query","required":false,"schema":{"type":"string"},"description":"Comma-separated list of relationships to include. Available: createdBy, flowVersions.deployments, virtualEnvironments, deployments.virtualEnvironment.deployedVersion, deployments.user, package, flowVersionDeployments, flowVersionDeployments, flowVersionDeployments"},{"name":"sort","in":"query","required":false,"schema":{"type":"string"},"description":"Sort field. Prefix with - for descending. Available: name"},{"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"},"401":{"description":"Unauthenticated"},"403":{"description":"Unauthorized"}}}}}}
```

## List Packages

> Retrieves a paginated list of packages.

```json
{"openapi":"3.0.0","info":{"title":"Patchworks Core API","version":"1.0.0"},"tags":[{"name":"Packages"}],"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":{"PackagesListResponse":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Packages"}},"meta":{"$ref":"#/components/schemas/PaginationMeta"},"links":{"$ref":"#/components/schemas/PaginationLinks"}}},"Packages":{"type":"object","properties":{"id":{"type":"integer","description":"Unique identifier"},"name":{"type":"string"},"notes":{"type":"string"},"created_by":{"type":"string","items":{"type":"object"}},"priority":{"type":"integer"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"created_by_user":{"type":"array","items":{"type":"object"}},"flow_versions":{"type":"array","items":{"type":"object"}},"virtual_environments":{"type":"array","items":{"type":"object"}},"deployments":{"type":"array","items":{"type":"object"}},"flow_versions_count":{"type":"integer"},"deployments_count":{"type":"integer"},"flow_version_deployments_count":{"type":"integer"}}},"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/packages":{"get":{"summary":"List Packages","description":"Retrieves a paginated list of packages.","parameters":[{"name":"filter[name]","in":"query","required":false,"schema":{"type":"string"},"description":"Filter results by name."},{"name":"include","in":"query","required":false,"schema":{"type":"string"},"description":"Comma-separated list of relationships to include. Available: createdBy, flowVersions.deployments, virtualEnvironments, deployments.virtualEnvironment.deployedVersion, deployments.user, package, flowVersionDeployments, flowVersionDeployments, flowVersionDeployments"},{"name":"sort","in":"query","required":false,"schema":{"type":"string"},"description":"Sort field. Prefix with - for descending. Available: name"},{"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/PackagesListResponse"}}}},"401":{"description":"Unauthenticated"},"403":{"description":"Unauthorized"}},"tags":["Packages"]}}}}
```

## Create Package

> Creates a new package.

```json
{"openapi":"3.0.0","info":{"title":"Patchworks Core API","version":"1.0.0"},"tags":[{"name":"Packages"}],"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":{"PackagesResponse":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Packages"}}},"Packages":{"type":"object","properties":{"id":{"type":"integer","description":"Unique identifier"},"name":{"type":"string"},"notes":{"type":"string"},"created_by":{"type":"string","items":{"type":"object"}},"priority":{"type":"integer"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"created_by_user":{"type":"array","items":{"type":"object"}},"flow_versions":{"type":"array","items":{"type":"object"}},"virtual_environments":{"type":"array","items":{"type":"object"}},"deployments":{"type":"array","items":{"type":"object"}},"flow_versions_count":{"type":"integer"},"deployments_count":{"type":"integer"},"flow_version_deployments_count":{"type":"integer"}}},"ErrorResponse":{"type":"object","properties":{"message":{"type":"string"},"errors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}}}},"PackagesStoreRequest":{"type":"object","properties":{"notes":{"type":"string","maxLength":255,"nullable":true},"name":{"type":"string","maxLength":255}},"required":["name"]}}},"paths":{"/api/v1/packages":{"post":{"summary":"Create Package","description":"Creates a new package.","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PackagesResponse"}}}},"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/PackagesStoreRequest"}}}},"tags":["Packages"],"parameters":[]}}}}
```

## Get Package

> Retrieves the details of a specific package.

```json
{"openapi":"3.0.0","info":{"title":"Patchworks Core API","version":"1.0.0"},"tags":[{"name":"Packages"}],"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":{"PackagesResponse":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Packages"}}},"Packages":{"type":"object","properties":{"id":{"type":"integer","description":"Unique identifier"},"name":{"type":"string"},"notes":{"type":"string"},"created_by":{"type":"string","items":{"type":"object"}},"priority":{"type":"integer"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"created_by_user":{"type":"array","items":{"type":"object"}},"flow_versions":{"type":"array","items":{"type":"object"}},"virtual_environments":{"type":"array","items":{"type":"object"}},"deployments":{"type":"array","items":{"type":"object"}},"flow_versions_count":{"type":"integer"},"deployments_count":{"type":"integer"},"flow_version_deployments_count":{"type":"integer"}}}}},"paths":{"/api/v1/packages/{package}":{"get":{"summary":"Get Package","description":"Retrieves the details of a specific package.","parameters":[{"name":"package","in":"path","required":true,"schema":{"type":"string"},"description":"The package identifier."},{"name":"filter[name]","in":"query","required":false,"schema":{"type":"string"},"description":"Filter results by name."},{"name":"include","in":"query","required":false,"schema":{"type":"string"},"description":"Comma-separated list of relationships to include. Available: createdBy, flowVersions.deployments, virtualEnvironments, deployments.virtualEnvironment.deployedVersion, deployments.user, package, flowVersionDeployments, flowVersionDeployments, flowVersionDeployments"},{"name":"sort","in":"query","required":false,"schema":{"type":"string"},"description":"Sort field. Prefix with - for descending. Available: name"},{"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/PackagesResponse"}}}},"401":{"description":"Unauthenticated"},"403":{"description":"Unauthorized"}},"tags":["Packages"]}}}}
```

## Update Package

> Updates an existing package.

```json
{"openapi":"3.0.0","info":{"title":"Patchworks Core API","version":"1.0.0"},"tags":[{"name":"Packages"}],"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":{"PackagesResponse":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Packages"}}},"Packages":{"type":"object","properties":{"id":{"type":"integer","description":"Unique identifier"},"name":{"type":"string"},"notes":{"type":"string"},"created_by":{"type":"string","items":{"type":"object"}},"priority":{"type":"integer"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"created_by_user":{"type":"array","items":{"type":"object"}},"flow_versions":{"type":"array","items":{"type":"object"}},"virtual_environments":{"type":"array","items":{"type":"object"}},"deployments":{"type":"array","items":{"type":"object"}},"flow_versions_count":{"type":"integer"},"deployments_count":{"type":"integer"},"flow_version_deployments_count":{"type":"integer"}}},"ErrorResponse":{"type":"object","properties":{"message":{"type":"string"},"errors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}}}},"PackagesUpdateRequest":{"type":"object","properties":{"notes":{"type":"string","maxLength":255,"nullable":true},"name":{"type":"string","maxLength":255}}}}},"paths":{"/api/v1/packages/{package}":{"put":{"summary":"Update Package","description":"Updates an existing package.","parameters":[{"name":"package","in":"path","required":true,"schema":{"type":"string"},"description":"The package identifier."}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PackagesResponse"}}}},"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/PackagesUpdateRequest"}}}},"tags":["Packages"]}}}}
```

## Delete Package

> Permanently deletes a specific package.

```json
{"openapi":"3.0.0","info":{"title":"Patchworks Core API","version":"1.0.0"},"tags":[{"name":"Packages"}],"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/packages/{package}":{"delete":{"summary":"Delete Package","description":"Permanently deletes a specific package.","parameters":[{"name":"package","in":"path","required":true,"schema":{"type":"string"},"description":"The package identifier."}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageResponse"}}}},"401":{"description":"Unauthenticated"},"403":{"description":"Unauthorized"}},"tags":["Packages"]}}}}
```

## Compare Package

> Compares a specific package against the current state of a specific virtual environment.

```json
{"openapi":"3.0.0","info":{"title":"Patchworks Core API","version":"1.0.0"},"tags":[{"name":"Packages"}],"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/packages/{package}/compare/{virtual_environment}":{"get":{"summary":"Compare Package","description":"Compares a specific package against the current state of a specific virtual environment.","parameters":[{"name":"package","in":"path","required":true,"schema":{"type":"string"},"description":"The package identifier."},{"name":"virtual_environment","in":"path","required":true,"schema":{"type":"string"},"description":"The virtual environment identifier."}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthenticated"},"403":{"description":"Unauthorized"}},"tags":["Packages"]}}}}
```

## Deploy Package

> Deploys a specific package to a specific virtual environment.

```json
{"openapi":"3.0.0","info":{"title":"Patchworks Core API","version":"1.0.0"},"tags":[{"name":"Packages"}],"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"}}}}},"PackagesDeployDeployRequest":{"type":"object","properties":{"notes":{"type":"string"}}}}},"paths":{"/api/v1/packages/{package}/deploy/{virtual_environment}":{"post":{"summary":"Deploy Package","description":"Deploys a specific package to a specific virtual environment.","parameters":[{"name":"package","in":"path","required":true,"schema":{"type":"string"},"description":"The package identifier."},{"name":"virtual_environment","in":"path","required":true,"schema":{"type":"string"},"description":"The virtual environment 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"}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PackagesDeployDeployRequest"}}}},"tags":["Packages"]}}}}
```

## Create Package

> Adds a specific flow version to a specific package.

```json
{"openapi":"3.0.0","info":{"title":"Patchworks Core API","version":"1.0.0"},"tags":[{"name":"Packages"}],"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":{"FlowVersionsResponse":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/FlowVersions"}}},"FlowVersions":{"type":"object","properties":{"id":{"type":"integer","description":"Unique identifier"},"virtual_environment_id":{"type":"string"},"flow_version_id":{"type":"string"},"priority":{"type":"integer"},"cron_string":{"type":"string"},"microservice":{"type":"string"},"config":{"type":"string"},"flow_step_route_id":{"type":"integer"},"variables":{"type":"string","items":{"type":"object"}},"parent_id":{"type":"integer"},"type":{"type":"string"},"key":{"type":"string"},"value":{"type":"string"},"date_format":{"type":"string"},"secret":{"type":"string"},"enabled_at":{"type":"string"},"created_at":{"type":"string","format":"date-time","items":{"type":"object"}},"updated_at":{"type":"string","format":"date-time","items":{"type":"object"}},"flow_id":{"type":"integer"},"flow_name":{"type":"string"},"flow_priority":{"type":"string"},"iteration":{"type":"string"},"status":{"type":"string","enum":["Draft","Inactive","Deployed"]},"is_deployed":{"type":"boolean"},"is_editable":{"type":"boolean"},"deployed_at":{"type":"object","format":"date-time"},"deployed_by":{"type":"object"},"deployed_by_user":{"type":"object"},"deployments":{"type":"array","items":{"type":"object"}},"has_callback_step":{"type":"array","items":{"type":"object"}},"steps":{"type":"array","items":{"type":"object"}},"runs":{"type":"string"},"latest_run":{"type":"string"},"schedules":{"type":"string"},"filters":{"type":"array","items":{"type":"object"}},"steps_count":{"type":"array","items":{"type":"object"}},"pivot":{"type":"string"},"saved_at":{"type":"string","format":"date-time"},"saved_by":{"type":"string"},"saved_by_user":{"type":"object"}}},"ErrorResponse":{"type":"object","properties":{"message":{"type":"string"},"errors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}}}},"PackagesStoreFlowVersionsRequest":{"type":"object","properties":{"priority":{"type":"integer","minimum":1,"maximum":100,"nullable":true}}}}},"paths":{"/api/v1/packages/{package}/flow-versions/{flow_version}":{"post":{"summary":"Create Package","description":"Adds a specific flow version to a specific package.","parameters":[{"name":"package","in":"path","required":true,"schema":{"type":"string"},"description":"The package identifier."},{"name":"flow_version","in":"path","required":true,"schema":{"type":"string"},"description":"The flow version identifier."}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FlowVersionsResponse"}}}},"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/PackagesStoreFlowVersionsRequest"}}}},"tags":["Packages"]}}}}
```

## Delete Package

> Removes a specific flow version from a specific package.

```json
{"openapi":"3.0.0","info":{"title":"Patchworks Core API","version":"1.0.0"},"tags":[{"name":"Packages"}],"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/packages/{package}/flow-versions/{flow_version}":{"delete":{"summary":"Delete Package","description":"Removes a specific flow version from a specific package.","parameters":[{"name":"package","in":"path","required":true,"schema":{"type":"string"},"description":"The package identifier."},{"name":"flow_version","in":"path","required":true,"schema":{"type":"string"},"description":"The flow version identifier."}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageResponse"}}}},"401":{"description":"Unauthenticated"},"403":{"description":"Unauthorized"}},"tags":["Packages"]}}}}
```

## Delete Package Virtual Environment

> Removes a specific virtual environment from a specific package.

```json
{"openapi":"3.0.0","info":{"title":"Patchworks Core API","version":"1.0.0"},"tags":[{"name":"Packages"}],"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/packages/{package}/virtual-environments/{virtual_environment}":{"delete":{"summary":"Delete Package Virtual Environment","description":"Removes a specific virtual environment from a specific package.","parameters":[{"name":"package","in":"path","required":true,"schema":{"type":"string"},"description":"The package identifier."},{"name":"virtual_environment","in":"path","required":true,"schema":{"type":"string"},"description":"The virtual environment identifier."}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageResponse"}}}},"401":{"description":"Unauthenticated"},"403":{"description":"Unauthorized"}},"tags":["Packages"]}}}}
```
