pydo.projects.assign_resources()

Generated on 8 May 2026 from pydo version v0.34.0

Usage

client.projects.assign_resources(
    project_id="4de7ac8b-495b-4884-9a69-1050c6793cd6",
    body={
        "resources": [...],
    },
)
Returns JSONRaises HttpResponseError

Description

To assign resources to a project, send a POST request to /v2/projects/{project_id}/resources.

You must have both project:update and <resource>:read scopes to assign new resources. For example, to assign a Droplet to a project, include both the project:update and droplet:read scopes.

Parameters

project_id string required

A unique identifier for a project.

Min: 1

resources array of strings optional

Example: ['do:droplet:13457723']

A list of uniform resource names (URNs) to be added to a project. Only resources that you are authorized to see will be returned.

Request Sample

Show Request Sample
import os
from pydo import Client

client = Client(token=os.environ.get("DIGITALOCEAN_TOKEN"))

req = {
  "resources": [
    "do:droplet:13457723",
    "do:domain:example.com"
  ]
}

resp = client.projects.assign_resources(project_id="8dafda", body=req)

Response Example

Show Response Example
{
  "resources": [
    {
      "urn": "do:droplet:13457723",
      "assigned_at": "2018-09-28T19:26:37Z",
      "links": {
        "self": "https://api.digitalocean.com/v2/droplets/13457723"
      },
      "status": "ok"
    },
    {
      "urn": "do:domain:example.com",
      "assigned_at": "2019-03-31T16:24:14Z",
      "links": {
        "self": "https://api.digitalocean.com/v2/domains/example.com"
      },
      "status": "ok"
    }
  ]
}

More Information

See /v2/projects/{project_id}/resources in the API reference for additional detail on responses, headers, parameters, and more.

We can't find any results for your search.

Try using different keywords or simplifying your search terms.