# Validate and pin an updated Worker before persistence

`PUT /workers/{workerId}`



[Agents API guide](https://docs.contextual.io/tenants/tenant-apis/agents-api.md)

```json
{
  "openapi": "3.0.3",
  "info": {
    "title": "Contextual Agents Api",
    "description": " "
  },
  "security": [
    {
      "jwt": []
    }
  ],
  "servers": [
    {
      "url": "https://agents.{tenantId}.my.contextual.io/api/v1",
      "variables": {
        "tenantId": {
          "default": "YOUR-TENANT-ID"
        }
      }
    }
  ],
  "paths": {
    "/workers/{workerId}": {
      "put": {
        "tags": [
          "Workers"
        ],
        "summary": "Validate and pin an updated Worker before persistence",
        "parameters": [
          {
            "name": "workerId",
            "in": "path",
            "required": true
          }
        ],
        "deprecated": false,
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1
                  },
                  "description": {
                    "type": "string"
                  },
                  "size": {
                    "type": "string",
                    "minLength": 1
                  },
                  "minReplicas": {
                    "default": 1,
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 100
                  },
                  "maxReplicas": {
                    "default": 1,
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 100
                  },
                  "targetCpu": {
                    "default": 80,
                    "type": "number",
                    "minimum": 1,
                    "maximum": 100
                  },
                  "envVars": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "label": {
                          "type": "string"
                        },
                        "value": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "label",
                        "value"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "customDomain": {
                    "type": "string",
                    "pattern": "^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9-]*[a-zA-Z0-9])\\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9-]*[A-Za-z0-9])$"
                  },
                  "schedule": {
                    "type": "string",
                    "pattern": "^((\\*(\\/\\d+)?|([0-5]?\\d)(-([0-5]?\\d)(\\/\\d+)?)?(,([0-5]?\\d)(-([0-5]?\\d)(\\/\\d+)?)?)*)\\s+(\\*(\\/\\d+)?|([01]?\\d|2[0-3])(-([01]?\\d|2[0-3])(\\/\\d+)?)?(,([01]?\\d|2[0-3])(-([01]?\\d|2[0-3])(\\/\\d+)?)?)*)\\s+(\\*(\\/\\d+)?|(0?[1-9]|[12]\\d|3[01])(-(0?[1-9]|[12]\\d|3[01])(\\/\\d+)?)?(,(0?[1-9]|[12]\\d|3[01])(-(0?[1-9]|[12]\\d|3[01])(\\/\\d+)?)?)*)\\s+(\\*(\\/\\d+)?|([1-9]|1[012])(-([1-9]|1[012])(\\/\\d+)?)?(,([1-9]|1[012])(-([1-9]|1[012])(\\/\\d+)?)?)*|jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)\\s+(\\*(\\/\\d+)?|([0-6])(-([0-6])(\\/\\d+)?)?(,([0-6])(-([0-6])(\\/\\d+)?)?)*|mon|tue|wed|thu|fri|sat|sun)|(@yearly|@annually|@monthly|@weekly|@daily|@midnight|@hourly))$"
                  },
                  "image": {
                    "type": "string"
                  },
                  "compose": {
                    "type": "object",
                    "properties": {
                      "name": {
                        "type": "string"
                      },
                      "services": {
                        "type": "object",
                        "propertyNames": {
                          "type": "string",
                          "maxLength": 63,
                          "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$"
                        },
                        "additionalProperties": {
                          "type": "object",
                          "properties": {
                            "image": {
                              "type": "string"
                            },
                            "command": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            },
                            "entrypoint": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            },
                            "environment": {
                              "type": "object",
                              "propertyNames": {
                                "type": "string",
                                "pattern": "^[A-Za-z_][A-Za-z0-9_]*$"
                              },
                              "additionalProperties": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              }
                            },
                            "ports": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "target": {
                                    "type": "integer",
                                    "minimum": 1,
                                    "maximum": 65535
                                  },
                                  "published": {
                                    "type": "string"
                                  },
                                  "protocol": {
                                    "type": "string",
                                    "const": "tcp"
                                  },
                                  "mode": {
                                    "type": "string",
                                    "const": "ingress"
                                  }
                                },
                                "required": [
                                  "target"
                                ],
                                "additionalProperties": false,
                                "patternProperties": {
                                  "^x-": {}
                                }
                              }
                            },
                            "expose": {
                              "type": "array",
                              "items": {
                                "type": "string",
                                "pattern": "^\\d{1,5}(\\/tcp)?$"
                              }
                            },
                            "depends_on": {
                              "type": "object",
                              "propertyNames": {
                                "type": "string"
                              },
                              "additionalProperties": {
                                "type": "object",
                                "properties": {
                                  "condition": {
                                    "type": "string",
                                    "enum": [
                                      "service_started",
                                      "service_healthy",
                                      "service_completed_successfully"
                                    ]
                                  },
                                  "required": {
                                    "type": "boolean",
                                    "const": true
                                  },
                                  "restart": {
                                    "type": "boolean",
                                    "const": false
                                  }
                                },
                                "required": [
                                  "condition"
                                ],
                                "additionalProperties": false,
                                "patternProperties": {
                                  "^x-": {}
                                }
                              }
                            },
                            "healthcheck": {
                              "type": "object",
                              "properties": {
                                "test": {
                                  "minItems": 1,
                                  "maxItems": 64,
                                  "type": "array",
                                  "items": {
                                    "type": "string"
                                  }
                                },
                                "interval": {
                                  "type": "string"
                                },
                                "timeout": {
                                  "type": "string"
                                },
                                "retries": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 120
                                },
                                "start_period": {
                                  "type": "string"
                                },
                                "start_interval": {
                                  "type": "string"
                                },
                                "disable": {
                                  "type": "boolean"
                                }
                              },
                              "additionalProperties": false,
                              "patternProperties": {
                                "^x-": {}
                              }
                            },
                            "volumes": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "type": {
                                    "type": "string",
                                    "const": "volume"
                                  },
                                  "source": {
                                    "type": "string"
                                  },
                                  "target": {
                                    "type": "string",
                                    "format": "starts_with",
                                    "pattern": "^\\/.*"
                                  },
                                  "read_only": {
                                    "type": "boolean"
                                  },
                                  "volume": {
                                    "type": "object",
                                    "properties": {
                                      "nocopy": {
                                        "type": "boolean",
                                        "const": true
                                      },
                                      "subpath": {
                                        "type": "string",
                                        "pattern": "^(?!.*(?:^|\\/)\\.{1,2}(?:\\/|$))[^/][^\\\\]*$"
                                      }
                                    },
                                    "additionalProperties": false,
                                    "patternProperties": {
                                      "^x-": {}
                                    }
                                  }
                                },
                                "required": [
                                  "type",
                                  "source",
                                  "target"
                                ],
                                "additionalProperties": false,
                                "patternProperties": {
                                  "^x-": {}
                                }
                              }
                            },
                            "configs": {
                              "type": "array",
                              "items": {
                                "anyOf": [
                                  {
                                    "type": "string",
                                    "pattern": "^(?!\\.$)(?!\\.\\.)[A-Za-z0-9._-]{1,253}$"
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "source": {
                                        "type": "string",
                                        "pattern": "^(?!\\.$)(?!\\.\\.)[A-Za-z0-9._-]{1,253}$"
                                      },
                                      "target": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "mode": {
                                        "type": "integer",
                                        "minimum": 0,
                                        "maximum": 511
                                      }
                                    },
                                    "required": [
                                      "source"
                                    ],
                                    "additionalProperties": false,
                                    "patternProperties": {
                                      "^x-": {}
                                    }
                                  }
                                ]
                              }
                            },
                            "secrets": {
                              "type": "array",
                              "items": {
                                "anyOf": [
                                  {
                                    "type": "string",
                                    "pattern": "^(?!\\.$)(?!\\.\\.)[A-Za-z0-9._-]{1,253}$"
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "source": {
                                        "type": "string",
                                        "pattern": "^(?!\\.$)(?!\\.\\.)[A-Za-z0-9._-]{1,253}$"
                                      },
                                      "target": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "mode": {
                                        "type": "integer",
                                        "minimum": 0,
                                        "maximum": 511
                                      }
                                    },
                                    "required": [
                                      "source"
                                    ],
                                    "additionalProperties": false,
                                    "patternProperties": {
                                      "^x-": {}
                                    }
                                  }
                                ]
                              }
                            },
                            "working_dir": {
                              "type": "string",
                              "format": "starts_with",
                              "pattern": "^\\/.*"
                            },
                            "networks": {
                              "type": "object",
                              "propertyNames": {
                                "type": "string"
                              },
                              "additionalProperties": {
                                "type": "null"
                              }
                            },
                            "x-contextual": {
                              "type": "object",
                              "properties": {
                                "public": {
                                  "anyOf": [
                                    {
                                      "type": "boolean"
                                    },
                                    {
                                      "type": "integer",
                                      "minimum": 1,
                                      "maximum": 65535
                                    }
                                  ]
                                },
                                "container_type": {
                                  "type": "string",
                                  "enum": [
                                    "primary",
                                    "sidecar",
                                    "init"
                                  ]
                                },
                                "http_healthcheck": {
                                  "type": "object",
                                  "properties": {
                                    "path": {
                                      "type": "string",
                                      "maxLength": 2048,
                                      "format": "starts_with",
                                      "pattern": "^\\/.*"
                                    },
                                    "port": {
                                      "type": "integer",
                                      "minimum": 1024,
                                      "maximum": 65535
                                    }
                                  },
                                  "required": [
                                    "path",
                                    "port"
                                  ],
                                  "additionalProperties": false
                                },
                                "features": {
                                  "type": "array",
                                  "items": {
                                    "type": "string",
                                    "enum": [
                                      "messaging",
                                      "native-object-api",
                                      "logging",
                                      "platform-services",
                                      "messaging-producer",
                                      "keda"
                                    ]
                                  }
                                },
                                "scaling": {
                                  "type": "object",
                                  "properties": {
                                    "maxReplicas": {
                                      "default": 1,
                                      "type": "integer",
                                      "minimum": 1,
                                      "maximum": 100
                                    },
                                    "pollingInterval": {
                                      "default": 20,
                                      "type": "integer",
                                      "minimum": 5,
                                      "maximum": 9007199254740991
                                    },
                                    "minReplicas": {
                                      "default": 0,
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 100
                                    },
                                    "cooldownPeriod": {
                                      "default": 5,
                                      "type": "number",
                                      "minimum": 0
                                    },
                                    "lagThreshold": {
                                      "default": 100,
                                      "type": "number",
                                      "minimum": 2
                                    }
                                  },
                                  "required": [
                                    "maxReplicas",
                                    "pollingInterval",
                                    "minReplicas",
                                    "cooldownPeriod",
                                    "lagThreshold"
                                  ],
                                  "additionalProperties": false
                                }
                              },
                              "additionalProperties": false,
                              "patternProperties": {
                                "^x-": {}
                              }
                            }
                          },
                          "required": [
                            "image"
                          ],
                          "additionalProperties": false,
                          "patternProperties": {
                            "^x-": {}
                          }
                        }
                      },
                      "volumes": {
                        "type": "object",
                        "propertyNames": {
                          "type": "string",
                          "maxLength": 63,
                          "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$"
                        },
                        "additionalProperties": {
                          "type": "object",
                          "properties": {
                            "name": {
                              "type": "string"
                            }
                          },
                          "additionalProperties": false,
                          "patternProperties": {
                            "^x-": {}
                          }
                        }
                      },
                      "configs": {
                        "type": "object",
                        "propertyNames": {
                          "type": "string",
                          "pattern": "^(?!\\.$)(?!\\.\\.)[A-Za-z0-9._-]{1,253}$"
                        },
                        "additionalProperties": {
                          "type": "object",
                          "properties": {
                            "content": {
                              "type": "string"
                            },
                            "name": {
                              "type": "string"
                            },
                            "file": {
                              "not": {}
                            },
                            "environment": {
                              "not": {}
                            }
                          },
                          "required": [
                            "content"
                          ],
                          "additionalProperties": false,
                          "patternProperties": {
                            "^x-": {}
                          }
                        }
                      },
                      "secrets": {
                        "type": "object",
                        "propertyNames": {
                          "type": "string",
                          "pattern": "^(?!\\.$)(?!\\.\\.)[A-Za-z0-9._-]{1,253}$"
                        },
                        "additionalProperties": {
                          "type": "object",
                          "properties": {
                            "environment": {
                              "type": "string",
                              "pattern": "^[A-Z_][A-Z0-9_]*$"
                            },
                            "name": {
                              "type": "string"
                            },
                            "file": {
                              "not": {}
                            }
                          },
                          "required": [
                            "environment"
                          ],
                          "additionalProperties": false,
                          "patternProperties": {
                            "^x-": {}
                          }
                        }
                      },
                      "networks": {
                        "type": "object",
                        "propertyNames": {
                          "type": "string"
                        },
                        "additionalProperties": {}
                      },
                      "x-contextual": {
                        "type": "object",
                        "properties": {
                          "version": {
                            "type": "number",
                            "const": 1
                          }
                        },
                        "required": [
                          "version"
                        ],
                        "additionalProperties": false,
                        "patternProperties": {
                          "^x-": {}
                        }
                      }
                    },
                    "required": [
                      "services",
                      "x-contextual"
                    ],
                    "additionalProperties": false,
                    "patternProperties": {
                      "^x-": {}
                    }
                  },
                  "managed": {
                    "type": "object",
                    "properties": {
                      "name": {
                        "type": "string",
                        "maxLength": 128,
                        "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$"
                      },
                      "version": {
                        "type": "string",
                        "pattern": "^[A-Za-z0-9_][A-Za-z0-9_.-]{0,127}$"
                      },
                      "options": {
                        "type": "object",
                        "propertyNames": {
                          "type": "string",
                          "pattern": "^[A-Za-z_][A-Za-z0-9_]*$"
                        },
                        "additionalProperties": {
                          "type": "string",
                          "maxLength": 4096
                        }
                      },
                      "digest": {
                        "type": "string",
                        "pattern": "^sha256:[a-f0-9]{64}$"
                      }
                    },
                    "required": [
                      "name",
                      "version"
                    ],
                    "additionalProperties": false
                  },
                  "template": {
                    "type": "object",
                    "properties": {
                      "name": {
                        "type": "string",
                        "maxLength": 128,
                        "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$"
                      },
                      "version": {
                        "type": "string",
                        "pattern": "^[A-Za-z0-9_][A-Za-z0-9_.-]{0,127}$"
                      },
                      "options": {
                        "type": "object",
                        "propertyNames": {
                          "type": "string",
                          "pattern": "^[A-Za-z_][A-Za-z0-9_]*$"
                        },
                        "additionalProperties": {
                          "type": "string",
                          "maxLength": 4096
                        }
                      },
                      "digest": {
                        "type": "string",
                        "pattern": "^sha256:[a-f0-9]{64}$"
                      }
                    },
                    "required": [
                      "name",
                      "version"
                    ],
                    "additionalProperties": false
                  }
                },
                "required": [
                  "name",
                  "size",
                  "minReplicas",
                  "maxReplicas",
                  "targetCpu"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Worker"
                }
              }
            }
          },
          "400": {
            "description": "Invalid Worker configuration",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/$ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid authorization header",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/$ErrorResponse"
                }
              }
            }
          },
          "402": {
            "description": "Agent plan limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/$ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Invalid permissions",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/$ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Worker not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/$ErrorResponse"
                }
              }
            }
          },
          "503": {
            "description": "Worker deployment dependency unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/$ErrorResponse"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "jwt": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "JWT"
      }
    },
    "schemas": {
      "Worker": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1
          },
          "description": {
            "type": "string"
          },
          "size": {
            "type": "string",
            "minLength": 1
          },
          "minReplicas": {
            "default": 1,
            "type": "integer",
            "minimum": 1,
            "maximum": 100
          },
          "maxReplicas": {
            "default": 1,
            "type": "integer",
            "minimum": 1,
            "maximum": 100
          },
          "targetCpu": {
            "default": 80,
            "type": "number",
            "minimum": 1,
            "maximum": 100
          },
          "envVars": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "label": {
                  "type": "string"
                },
                "value": {
                  "type": "string"
                }
              },
              "required": [
                "label",
                "value"
              ],
              "additionalProperties": false
            }
          },
          "customDomain": {
            "type": "string",
            "pattern": "^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9-]*[a-zA-Z0-9])\\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9-]*[A-Za-z0-9])$"
          },
          "schedule": {
            "type": "string",
            "pattern": "^((\\*(\\/\\d+)?|([0-5]?\\d)(-([0-5]?\\d)(\\/\\d+)?)?(,([0-5]?\\d)(-([0-5]?\\d)(\\/\\d+)?)?)*)\\s+(\\*(\\/\\d+)?|([01]?\\d|2[0-3])(-([01]?\\d|2[0-3])(\\/\\d+)?)?(,([01]?\\d|2[0-3])(-([01]?\\d|2[0-3])(\\/\\d+)?)?)*)\\s+(\\*(\\/\\d+)?|(0?[1-9]|[12]\\d|3[01])(-(0?[1-9]|[12]\\d|3[01])(\\/\\d+)?)?(,(0?[1-9]|[12]\\d|3[01])(-(0?[1-9]|[12]\\d|3[01])(\\/\\d+)?)?)*)\\s+(\\*(\\/\\d+)?|([1-9]|1[012])(-([1-9]|1[012])(\\/\\d+)?)?(,([1-9]|1[012])(-([1-9]|1[012])(\\/\\d+)?)?)*|jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)\\s+(\\*(\\/\\d+)?|([0-6])(-([0-6])(\\/\\d+)?)?(,([0-6])(-([0-6])(\\/\\d+)?)?)*|mon|tue|wed|thu|fri|sat|sun)|(@yearly|@annually|@monthly|@weekly|@daily|@midnight|@hourly))$"
          },
          "id": {
            "type": "string",
            "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$"
          },
          "image": {
            "type": "string",
            "maxLength": 512,
            "pattern": "^[a-z0-9]+(?:[.-][a-z0-9]+)*(?::[0-9]+)?\\/[a-z0-9]+(?:[._/-][a-z0-9]+)*(?::[A-Za-z0-9_][A-Za-z0-9_.-]{0,127})?@sha256:[a-f0-9]{64}$"
          },
          "compose": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string"
              },
              "services": {
                "type": "object",
                "propertyNames": {
                  "type": "string",
                  "maxLength": 63,
                  "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$"
                },
                "additionalProperties": {
                  "type": "object",
                  "properties": {
                    "image": {
                      "type": "string"
                    },
                    "command": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "entrypoint": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "environment": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string",
                        "pattern": "^[A-Za-z_][A-Za-z0-9_]*$"
                      },
                      "additionalProperties": {
                        "type": [
                          "string",
                          "null"
                        ]
                      }
                    },
                    "ports": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "target": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 65535
                          },
                          "published": {
                            "type": "string"
                          },
                          "protocol": {
                            "type": "string",
                            "const": "tcp"
                          },
                          "mode": {
                            "type": "string",
                            "const": "ingress"
                          }
                        },
                        "required": [
                          "target"
                        ],
                        "additionalProperties": false,
                        "patternProperties": {
                          "^x-": {}
                        }
                      }
                    },
                    "expose": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "pattern": "^\\d{1,5}(\\/tcp)?$"
                      }
                    },
                    "depends_on": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {
                        "type": "object",
                        "properties": {
                          "condition": {
                            "type": "string",
                            "enum": [
                              "service_started",
                              "service_healthy",
                              "service_completed_successfully"
                            ]
                          },
                          "required": {
                            "type": "boolean",
                            "const": true
                          },
                          "restart": {
                            "type": "boolean",
                            "const": false
                          }
                        },
                        "required": [
                          "condition"
                        ],
                        "additionalProperties": false,
                        "patternProperties": {
                          "^x-": {}
                        }
                      }
                    },
                    "healthcheck": {
                      "type": "object",
                      "properties": {
                        "test": {
                          "minItems": 1,
                          "maxItems": 64,
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "interval": {
                          "type": "string"
                        },
                        "timeout": {
                          "type": "string"
                        },
                        "retries": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 120
                        },
                        "start_period": {
                          "type": "string"
                        },
                        "start_interval": {
                          "type": "string"
                        },
                        "disable": {
                          "type": "boolean"
                        }
                      },
                      "additionalProperties": false,
                      "patternProperties": {
                        "^x-": {}
                      }
                    },
                    "volumes": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "const": "volume"
                          },
                          "source": {
                            "type": "string"
                          },
                          "target": {
                            "type": "string",
                            "format": "starts_with",
                            "pattern": "^\\/.*"
                          },
                          "read_only": {
                            "type": "boolean"
                          },
                          "volume": {
                            "type": "object",
                            "properties": {
                              "nocopy": {
                                "type": "boolean",
                                "const": true
                              },
                              "subpath": {
                                "type": "string",
                                "pattern": "^(?!.*(?:^|\\/)\\.{1,2}(?:\\/|$))[^/][^\\\\]*$"
                              }
                            },
                            "additionalProperties": false,
                            "patternProperties": {
                              "^x-": {}
                            }
                          }
                        },
                        "required": [
                          "type",
                          "source",
                          "target"
                        ],
                        "additionalProperties": false,
                        "patternProperties": {
                          "^x-": {}
                        }
                      }
                    },
                    "configs": {
                      "type": "array",
                      "items": {
                        "anyOf": [
                          {
                            "type": "string",
                            "pattern": "^(?!\\.$)(?!\\.\\.)[A-Za-z0-9._-]{1,253}$"
                          },
                          {
                            "type": "object",
                            "properties": {
                              "source": {
                                "type": "string",
                                "pattern": "^(?!\\.$)(?!\\.\\.)[A-Za-z0-9._-]{1,253}$"
                              },
                              "target": {
                                "type": "string",
                                "minLength": 1
                              },
                              "mode": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 511
                              }
                            },
                            "required": [
                              "source"
                            ],
                            "additionalProperties": false,
                            "patternProperties": {
                              "^x-": {}
                            }
                          }
                        ]
                      }
                    },
                    "secrets": {
                      "type": "array",
                      "items": {
                        "anyOf": [
                          {
                            "type": "string",
                            "pattern": "^(?!\\.$)(?!\\.\\.)[A-Za-z0-9._-]{1,253}$"
                          },
                          {
                            "type": "object",
                            "properties": {
                              "source": {
                                "type": "string",
                                "pattern": "^(?!\\.$)(?!\\.\\.)[A-Za-z0-9._-]{1,253}$"
                              },
                              "target": {
                                "type": "string",
                                "minLength": 1
                              },
                              "mode": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 511
                              }
                            },
                            "required": [
                              "source"
                            ],
                            "additionalProperties": false,
                            "patternProperties": {
                              "^x-": {}
                            }
                          }
                        ]
                      }
                    },
                    "working_dir": {
                      "type": "string",
                      "format": "starts_with",
                      "pattern": "^\\/.*"
                    },
                    "networks": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {
                        "type": "null"
                      }
                    },
                    "x-contextual": {
                      "type": "object",
                      "properties": {
                        "public": {
                          "anyOf": [
                            {
                              "type": "boolean"
                            },
                            {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 65535
                            }
                          ]
                        },
                        "container_type": {
                          "type": "string",
                          "enum": [
                            "primary",
                            "sidecar",
                            "init"
                          ]
                        },
                        "http_healthcheck": {
                          "type": "object",
                          "properties": {
                            "path": {
                              "type": "string",
                              "maxLength": 2048,
                              "format": "starts_with",
                              "pattern": "^\\/.*"
                            },
                            "port": {
                              "type": "integer",
                              "minimum": 1024,
                              "maximum": 65535
                            }
                          },
                          "required": [
                            "path",
                            "port"
                          ],
                          "additionalProperties": false
                        },
                        "features": {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "enum": [
                              "messaging",
                              "native-object-api",
                              "logging",
                              "platform-services",
                              "messaging-producer",
                              "keda"
                            ]
                          }
                        },
                        "scaling": {
                          "type": "object",
                          "properties": {
                            "maxReplicas": {
                              "default": 1,
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 100
                            },
                            "pollingInterval": {
                              "default": 20,
                              "type": "integer",
                              "minimum": 5,
                              "maximum": 9007199254740991
                            },
                            "minReplicas": {
                              "default": 0,
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 100
                            },
                            "cooldownPeriod": {
                              "default": 5,
                              "type": "number",
                              "minimum": 0
                            },
                            "lagThreshold": {
                              "default": 100,
                              "type": "number",
                              "minimum": 2
                            }
                          },
                          "required": [
                            "maxReplicas",
                            "pollingInterval",
                            "minReplicas",
                            "cooldownPeriod",
                            "lagThreshold"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "additionalProperties": false,
                      "patternProperties": {
                        "^x-": {}
                      }
                    }
                  },
                  "required": [
                    "image"
                  ],
                  "additionalProperties": false,
                  "patternProperties": {
                    "^x-": {}
                  }
                }
              },
              "volumes": {
                "type": "object",
                "propertyNames": {
                  "type": "string",
                  "maxLength": 63,
                  "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$"
                },
                "additionalProperties": {
                  "type": "object",
                  "properties": {
                    "name": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": false,
                  "patternProperties": {
                    "^x-": {}
                  }
                }
              },
              "configs": {
                "type": "object",
                "propertyNames": {
                  "type": "string",
                  "pattern": "^(?!\\.$)(?!\\.\\.)[A-Za-z0-9._-]{1,253}$"
                },
                "additionalProperties": {
                  "type": "object",
                  "properties": {
                    "content": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "file": {
                      "not": {}
                    },
                    "environment": {
                      "not": {}
                    }
                  },
                  "required": [
                    "content"
                  ],
                  "additionalProperties": false,
                  "patternProperties": {
                    "^x-": {}
                  }
                }
              },
              "secrets": {
                "type": "object",
                "propertyNames": {
                  "type": "string",
                  "pattern": "^(?!\\.$)(?!\\.\\.)[A-Za-z0-9._-]{1,253}$"
                },
                "additionalProperties": {
                  "type": "object",
                  "properties": {
                    "environment": {
                      "type": "string",
                      "pattern": "^[A-Z_][A-Z0-9_]*$"
                    },
                    "name": {
                      "type": "string"
                    },
                    "file": {
                      "not": {}
                    }
                  },
                  "required": [
                    "environment"
                  ],
                  "additionalProperties": false,
                  "patternProperties": {
                    "^x-": {}
                  }
                }
              },
              "networks": {
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {}
              },
              "x-contextual": {
                "type": "object",
                "properties": {
                  "version": {
                    "type": "number",
                    "const": 1
                  }
                },
                "required": [
                  "version"
                ],
                "additionalProperties": false,
                "patternProperties": {
                  "^x-": {}
                }
              }
            },
            "required": [
              "services",
              "x-contextual"
            ],
            "additionalProperties": false,
            "patternProperties": {
              "^x-": {}
            }
          },
          "managed": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string",
                "maxLength": 128,
                "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$"
              },
              "version": {
                "type": "string",
                "pattern": "^[A-Za-z0-9_][A-Za-z0-9_.-]{0,127}$"
              },
              "options": {
                "type": "object",
                "propertyNames": {
                  "type": "string",
                  "pattern": "^[A-Za-z_][A-Za-z0-9_]*$"
                },
                "additionalProperties": {
                  "type": "string",
                  "maxLength": 4096
                }
              },
              "digest": {
                "type": "string",
                "pattern": "^sha256:[a-f0-9]{64}$"
              }
            },
            "required": [
              "name",
              "version",
              "options",
              "digest"
            ],
            "additionalProperties": false
          },
          "template": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string",
                "maxLength": 128,
                "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$"
              },
              "version": {
                "type": "string",
                "pattern": "^[A-Za-z0-9_][A-Za-z0-9_.-]{0,127}$"
              },
              "options": {
                "type": "object",
                "propertyNames": {
                  "type": "string",
                  "pattern": "^[A-Za-z_][A-Za-z0-9_]*$"
                },
                "additionalProperties": {
                  "type": "string",
                  "maxLength": 4096
                }
              },
              "digest": {
                "type": "string",
                "pattern": "^sha256:[a-f0-9]{64}$"
              }
            },
            "required": [
              "name",
              "version",
              "options",
              "digest"
            ],
            "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"
              }
            },
            "required": [
              "id",
              "createdAt"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "name",
          "size",
          "minReplicas",
          "maxReplicas",
          "targetCpu",
          "id",
          "_metaData"
        ],
        "additionalProperties": false
      },
      "$ErrorResponse": {
        "type": "object",
        "properties": {
          "code": {
            "type": [
              "string",
              "number"
            ]
          },
          "message": {
            "type": "string"
          },
          "errors": {
            "type": "array",
            "items": {}
          }
        },
        "required": [
          "code",
          "message"
        ],
        "additionalProperties": false
      }
    }
  }
}
```