dots.v2.projects.byProject_id().resources.post()

Generated on 13 Nov 2026 from DoTs version v1.24.0

Usage

client.v2.projects.byProject_id(project_id).resources.post(body: Project_assignment, requestConfiguration?: RequestConfiguration<object>): Promise<undefined | ResourcesPostResponse>

Description

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

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

Parameters

Path Parameters

project_id string required

Example: 4de7ac8b-495b-4884-9a69-1050c6793cd6

A unique identifier for a project.

Min: 1

Request Body

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 { FetchRequestAdapter } from "@microsoft/kiota-http-fetchlibrary";
import {
    createDigitalOceanClient,
    DigitalOceanApiKeyAuthenticationProvider,
} from "@digitalocean/dots";

const authProvider = new DigitalOceanApiKeyAuthenticationProvider(process.env.DIGITALOCEAN_TOKEN!);
const adapter = new FetchRequestAdapter(authProvider);
const client = createDigitalOceanClient(adapter);

const response = await client.v2.projects
    .byProject_id("4de7ac8b-495b-4884-9a69-1050c6793cd6").resources.post({
    resources: [
        "do:droplet:13457723",
        "do:domain:example.com",
    ],
});

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.