Skip to content
Start here

Create repository

managed_defense.vulnerability_discovery.repositories.create(RepositoryCreateParams**kwargs) -> RepositoryCreateResponse
POST/accounts/{account_id}/managed-defense/vulnerability-discovery/repos

Creates an upload repository or reserves an asynchronous deployed Worker import by name. Worker imports require Idempotency-Key.

Security
API Token

The preferred authorization scheme for interacting with the Cloudflare API. Create a token.

Example:Authorization: Bearer Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY
API Email + API Key

The previous authorization scheme for interacting with the Cloudflare API, used in conjunction with a Global API key.

Example:X-Auth-Email: user@example.com

The previous authorization scheme for interacting with the Cloudflare API. When possible, use API tokens instead of Global API keys.

Example:X-Auth-Key: 144c9defac04969c7bfad8efaa8ea194
ParametersExpand Collapse
account_id: str
name: str
maxLength255
minLength1
worker_script_name: Optional[str]
maxLength255
minLength1
idempotency_key: Optional[str]
maxLength128
minLength1
ReturnsExpand Collapse
One of the following:
class UnionMember0: …
repository: UnionMember0Repository
id: str
formatuuid
name: str
maxLength255
minLength1
readiness: Literal["awaiting_source", "processing", "ready", "failed"]
One of the following:
"awaiting_source"
"processing"
"ready"
"failed"
source: Literal["upload", "worker"]
One of the following:
"upload"
"worker"
import_error: Optional[UnionMember0RepositoryImportError]
code: Literal["worker_import_failed"]
message: Literal["Worker import failed."]
upload: UnionMember0Upload
token: str
maxLength8192
minLength1
expires_in: Literal[3600]
remote: str
formaturi
maxLength2048
class Repository: …
repository: RepositoryRepository
id: str
formatuuid
name: str
maxLength255
minLength1
readiness: Literal["awaiting_source", "processing", "ready", "failed"]
One of the following:
"awaiting_source"
"processing"
"ready"
"failed"
source: Literal["upload", "worker"]
One of the following:
"upload"
"worker"
import_error: Optional[RepositoryRepositoryImportError]
code: Literal["worker_import_failed"]
message: Literal["Worker import failed."]

Create repository

import os
from cloudflare import Cloudflare

client = Cloudflare(
    api_token=os.environ.get("CLOUDFLARE_API_TOKEN"),  # This is the default and can be omitted
)
repository = client.managed_defense.vulnerability_discovery.repositories.create(
    account_id="023e105f4ecef8ad9ca31a8372d0c353",
    name="x",
)
print(repository)
{
  "errors": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "messages": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "result": {
    "repository": {
      "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
      "name": "x",
      "readiness": "awaiting_source",
      "source": "upload",
      "import_error": {
        "code": "worker_import_failed",
        "message": "Worker import failed."
      }
    },
    "upload": {
      "token": "x",
      "expires_in": 3600,
      "remote": "https://example.com"
    }
  },
  "success": true
}
Returns Examples
{
  "errors": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "messages": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "result": {
    "repository": {
      "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
      "name": "x",
      "readiness": "awaiting_source",
      "source": "upload",
      "import_error": {
        "code": "worker_import_failed",
        "message": "Worker import failed."
      }
    },
    "upload": {
      "token": "x",
      "expires_in": 3600,
      "remote": "https://example.com"
    }
  },
  "success": true
}