Home
/
Reference
/
REST API
/
Organizations

Organizations

Add new license

Code samples

# Example request using curl
curl -X POST http://coder-server:8080/api/v2/licenses \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -H 'Coder-Session-Token: API_KEY'

POST /licenses

Body parameter

{
  "license": "string"
}

Parameters

NameInTypeRequiredDescription
bodybodycodersdk.AddLicenseRequesttrueAdd license request

Example responses

201 Response

{
  "claims": {},
  "id": 0,
  "uploaded_at": "2019-08-24T14:15:22Z",
  "uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f"
}

Responses

StatusMeaningDescriptionSchema
201CreatedCreatedcodersdk.License

To perform this operation, you must be authenticated. Learn more.

Update license entitlements

Code samples

# Example request using curl
curl -X POST http://coder-server:8080/api/v2/licenses/refresh-entitlements \
  -H 'Accept: application/json' \
  -H 'Coder-Session-Token: API_KEY'

POST /licenses/refresh-entitlements

Example responses

201 Response

{
  "detail": "string",
  "message": "string",
  "validations": [
    {
      "detail": "string",
      "field": "string"
    }
  ]
}

Responses

StatusMeaningDescriptionSchema
201CreatedCreatedcodersdk.Response

To perform this operation, you must be authenticated. Learn more.

Get organizations

Code samples

# Example request using curl
curl -X GET http://coder-server:8080/api/v2/organizations \
  -H 'Accept: application/json' \
  -H 'Coder-Session-Token: API_KEY'

GET /organizations

Example responses

200 Response

[
  {
    "created_at": "2019-08-24T14:15:22Z",
    "description": "string",
    "display_name": "string",
    "icon": "string",
    "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
    "is_default": true,
    "name": "string",
    "updated_at": "2019-08-24T14:15:22Z"
  }
]

Responses

StatusMeaningDescriptionSchema
200OKOKarray of codersdk.Organization

Response Schema

Status Code 200

NameTypeRequiredRestrictionsDescription
[array item]arrayfalse
» created_atstring(date-time)true
» descriptionstringfalse
» display_namestringfalse
» iconstringfalse
» idstring(uuid)true
» is_defaultbooleantrue
» namestringfalse
» updated_atstring(date-time)true

To perform this operation, you must be authenticated. Learn more.

Create organization

Code samples

# Example request using curl
curl -X POST http://coder-server:8080/api/v2/organizations \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -H 'Coder-Session-Token: API_KEY'

POST /organizations

Body parameter

{
  "description": "string",
  "display_name": "string",
  "icon": "string",
  "name": "string"
}

Parameters

NameInTypeRequiredDescription
bodybodycodersdk.CreateOrganizationRequesttrueCreate organization request

Example responses

201 Response

{
  "created_at": "2019-08-24T14:15:22Z",
  "description": "string",
  "display_name": "string",
  "icon": "string",
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "is_default": true,
  "name": "string",
  "updated_at": "2019-08-24T14:15:22Z"
}

Responses

StatusMeaningDescriptionSchema
201CreatedCreatedcodersdk.Organization

To perform this operation, you must be authenticated. Learn more.

Get organization by ID

Code samples

# Example request using curl
curl -X GET http://coder-server:8080/api/v2/organizations/{organization} \
  -H 'Accept: application/json' \
  -H 'Coder-Session-Token: API_KEY'

GET /organizations/{organization}

Parameters

NameInTypeRequiredDescription
organizationpathstring(uuid)trueOrganization ID

Example responses

200 Response

{
  "created_at": "2019-08-24T14:15:22Z",
  "description": "string",
  "display_name": "string",
  "icon": "string",
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "is_default": true,
  "name": "string",
  "updated_at": "2019-08-24T14:15:22Z"
}

Responses

StatusMeaningDescriptionSchema
200OKOKcodersdk.Organization

To perform this operation, you must be authenticated. Learn more.

Delete organization

Code samples

# Example request using curl
curl -X DELETE http://coder-server:8080/api/v2/organizations/{organization} \
  -H 'Accept: application/json' \
  -H 'Coder-Session-Token: API_KEY'

DELETE /organizations/{organization}

Parameters

NameInTypeRequiredDescription
organizationpathstringtrueOrganization ID or name

Example responses

200 Response

{
  "detail": "string",
  "message": "string",
  "validations": [
    {
      "detail": "string",
      "field": "string"
    }
  ]
}

Responses

StatusMeaningDescriptionSchema
200OKOKcodersdk.Response

To perform this operation, you must be authenticated. Learn more.

Update organization

Code samples

# Example request using curl
curl -X PATCH http://coder-server:8080/api/v2/organizations/{organization} \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -H 'Coder-Session-Token: API_KEY'

PATCH /organizations/{organization}

Body parameter

{
  "description": "string",
  "display_name": "string",
  "icon": "string",
  "name": "string"
}

Parameters

NameInTypeRequiredDescription
organizationpathstringtrueOrganization ID or name
bodybodycodersdk.UpdateOrganizationRequesttruePatch organization request

Example responses

200 Response

{
  "created_at": "2019-08-24T14:15:22Z",
  "description": "string",
  "display_name": "string",
  "icon": "string",
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "is_default": true,
  "name": "string",
  "updated_at": "2019-08-24T14:15:22Z"
}

Responses

StatusMeaningDescriptionSchema
200OKOKcodersdk.Organization

To perform this operation, you must be authenticated. Learn more.

Get provisioner jobs

Code samples

# Example request using curl
curl -X GET http://coder-server:8080/api/v2/organizations/{organization}/provisionerjobs \
  -H 'Accept: application/json' \
  -H 'Coder-Session-Token: API_KEY'

GET /organizations/{organization}/provisionerjobs

Parameters

NameInTypeRequiredDescription
organizationpathstring(uuid)trueOrganization ID
limitqueryintegerfalsePage limit
idsqueryarray(uuid)falseFilter results by job IDs
statusquerystringfalseFilter results by status
tagsqueryobjectfalseProvisioner tags to filter by (JSON of the form {'tag1':'value1','tag2':'value2'})

Enumerated Values

ParameterValue
statuspending
statusrunning
statussucceeded
statuscanceling
statuscanceled
statusfailed
statusunknown
statuspending
statusrunning
statussucceeded
statuscanceling
statuscanceled
statusfailed

Example responses

200 Response

[
  {
    "available_workers": [
      "497f6eca-6276-4993-bfeb-53cbbbba6f08"
    ],
    "canceled_at": "2019-08-24T14:15:22Z",
    "completed_at": "2019-08-24T14:15:22Z",
    "created_at": "2019-08-24T14:15:22Z",
    "error": "string",
    "error_code": "REQUIRED_TEMPLATE_VARIABLES",
    "file_id": "8a0cfb4f-ddc9-436d-91bb-75133c583767",
    "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
    "input": {
      "error": "string",
      "template_version_id": "0ba39c92-1f1b-4c32-aa3e-9925d7713eb1",
      "workspace_build_id": "badaf2eb-96c5-4050-9f1d-db2d39ca5478"
    },
    "metadata": {
      "template_display_name": "string",
      "template_icon": "string",
      "template_id": "c6d67e98-83ea-49f0-8812-e4abae2b68bc",
      "template_name": "string",
      "template_version_name": "string",
      "workspace_id": "0967198e-ec7b-4c6b-b4d3-f71244cadbe9",
      "workspace_name": "string"
    },
    "organization_id": "7c60d51f-b44e-4682-87d6-449835ea4de6",
    "queue_position": 0,
    "queue_size": 0,
    "started_at": "2019-08-24T14:15:22Z",
    "status": "pending",
    "tags": {
      "property1": "string",
      "property2": "string"
    },
    "type": "template_version_import",
    "worker_id": "ae5fa6f7-c55b-40c1-b40a-b36ac467652b"
  }
]

Responses

StatusMeaningDescriptionSchema
200OKOKarray of codersdk.ProvisionerJob

Response Schema

Status Code 200

NameTypeRequiredRestrictionsDescription
[array item]arrayfalse
» available_workersarrayfalse
» canceled_atstring(date-time)false
» completed_atstring(date-time)false
» created_atstring(date-time)false
» errorstringfalse
» error_codecodersdk.JobErrorCodefalse
» file_idstring(uuid)false
» idstring(uuid)false
» inputcodersdk.ProvisionerJobInputfalse
»» errorstringfalse
»» template_version_idstring(uuid)false
»» workspace_build_idstring(uuid)false
» metadatacodersdk.ProvisionerJobMetadatafalse
»» template_display_namestringfalse
»» template_iconstringfalse
»» template_idstring(uuid)false
»» template_namestringfalse
»» template_version_namestringfalse
»» workspace_idstring(uuid)false
»» workspace_namestringfalse
» organization_idstring(uuid)false
» queue_positionintegerfalse
» queue_sizeintegerfalse
» started_atstring(date-time)false
» statuscodersdk.ProvisionerJobStatusfalse
» tagsobjectfalse
»» [any property]stringfalse
» typecodersdk.ProvisionerJobTypefalse
» worker_idstring(uuid)false

Enumerated Values

PropertyValue
error_codeREQUIRED_TEMPLATE_VARIABLES
statuspending
statusrunning
statussucceeded
statuscanceling
statuscanceled
statusfailed
typetemplate_version_import
typeworkspace_build
typetemplate_version_dry_run

To perform this operation, you must be authenticated. Learn more.

Get provisioner job

Code samples

# Example request using curl
curl -X GET http://coder-server:8080/api/v2/organizations/{organization}/provisionerjobs/{job} \
  -H 'Accept: application/json' \
  -H 'Coder-Session-Token: API_KEY'

GET /organizations/{organization}/provisionerjobs/{job}

Parameters

NameInTypeRequiredDescription
organizationpathstring(uuid)trueOrganization ID
jobpathstring(uuid)trueJob ID

Example responses

200 Response

{
  "available_workers": [
    "497f6eca-6276-4993-bfeb-53cbbbba6f08"
  ],
  "canceled_at": "2019-08-24T14:15:22Z",
  "completed_at": "2019-08-24T14:15:22Z",
  "created_at": "2019-08-24T14:15:22Z",
  "error": "string",
  "error_code": "REQUIRED_TEMPLATE_VARIABLES",
  "file_id": "8a0cfb4f-ddc9-436d-91bb-75133c583767",
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "input": {
    "error": "string",
    "template_version_id": "0ba39c92-1f1b-4c32-aa3e-9925d7713eb1",
    "workspace_build_id": "badaf2eb-96c5-4050-9f1d-db2d39ca5478"
  },
  "metadata": {
    "template_display_name": "string",
    "template_icon": "string",
    "template_id": "c6d67e98-83ea-49f0-8812-e4abae2b68bc",
    "template_name": "string",
    "template_version_name": "string",
    "workspace_id": "0967198e-ec7b-4c6b-b4d3-f71244cadbe9",
    "workspace_name": "string"
  },
  "organization_id": "7c60d51f-b44e-4682-87d6-449835ea4de6",
  "queue_position": 0,
  "queue_size": 0,
  "started_at": "2019-08-24T14:15:22Z",
  "status": "pending",
  "tags": {
    "property1": "string",
    "property2": "string"
  },
  "type": "template_version_import",
  "worker_id": "ae5fa6f7-c55b-40c1-b40a-b36ac467652b"
}

Responses

StatusMeaningDescriptionSchema
200OKOKcodersdk.ProvisionerJob

To perform this operation, you must be authenticated. Learn more.

See an opportunity to improve our docs? Make an edit.