Workspaces Reference

Kong Gateway’s workspaces feature is configurable through Kong’s Admin API.

The workspace object describes the workspace entity, which has an ID and a name.

For workspace use cases and configuration examples, see Workspace Examples.

Add workspace

Endpoint

/workspaces/

Request body

AttributeDescription
nameThe workspace name.

Response

  1. HTTP 201 Created
  1. {
  2. "comment": null,
  3. "config": {
  4. "meta": null,
  5. "portal": false,
  6. "portal_access_request_email": null,
  7. "portal_approved_email": null,
  8. "portal_auth": null,
  9. "portal_auth_conf": null,
  10. "portal_auto_approve": null,
  11. "portal_cors_origins": null,
  12. "portal_developer_meta_fields": "[{\"label\":\"Full Name\",\"title\":\"full_name\",\"validator\":{\"required\":true,\"type\":\"string\"}}]",
  13. "portal_emails_from": null,
  14. "portal_emails_reply_to": null,
  15. "portal_invite_email": null,
  16. "portal_reset_email": null,
  17. "portal_reset_success_email": null,
  18. "portal_token_exp": null
  19. },
  20. "created_at": 1557441226,
  21. "id": "c663cca5-c6f6-474a-ae44-01f62aba16a9",
  22. "meta": {
  23. "color": null,
  24. "thumbnail": null
  25. },
  26. "name": "green-team"
  27. }

List workspaces

Endpoint

/workspaces/

Response

  1. HTTP 200 OK
  1. {
  2. "data": [
  3. {
  4. "comment": null,
  5. "config": {
  6. "meta": null,
  7. "portal": false,
  8. "portal_access_request_email": null,
  9. "portal_approved_email": null,
  10. "portal_auth": null,
  11. "portal_auth_conf": null,
  12. "portal_auto_approve": null,
  13. "portal_cors_origins": null,
  14. "portal_developer_meta_fields": "[{\"label\":\"Full Name\",\"title\":\"full_name\",\"validator\":{\"required\":true,\"type\":\"string\"}}]",
  15. "portal_emails_from": null,
  16. "portal_emails_reply_to": null,
  17. "portal_invite_email": null,
  18. "portal_reset_email": null,
  19. "portal_reset_success_email": null,
  20. "portal_token_exp": null
  21. },
  22. "created_at": 1557419951,
  23. "id": "00000000-0000-0000-0000-000000000000",
  24. "meta": {
  25. "color": null,
  26. "thumbnail": null
  27. },
  28. "name": "default"
  29. },
  30. {
  31. "comment": null,
  32. "config": {
  33. "meta": null,
  34. "portal": false,
  35. "portal_access_request_email": null,
  36. "portal_approved_email": null,
  37. "portal_auth": null,
  38. "portal_auth_conf": null,
  39. "portal_auto_approve": null,
  40. "portal_cors_origins": null,
  41. "portal_developer_meta_fields": "[{\"label\":\"Full Name\",\"title\":\"full_name\",\"validator\":{\"required\":true,\"type\":\"string\"}}]",
  42. "portal_emails_from": null,
  43. "portal_emails_reply_to": null,
  44. "portal_invite_email": null,
  45. "portal_reset_email": null,
  46. "portal_reset_success_email": null,
  47. "portal_token_exp": null
  48. },
  49. "created_at": 1557441226,
  50. "id": "c663cca5-c6f6-474a-ae44-01f62aba16a9",
  51. "meta": {
  52. "color": null,
  53. "thumbnail": null
  54. },
  55. "name": "green-team"
  56. }
  57. ],
  58. "next": null
  59. }

Update or create a workspace

Endpoint

/workspaces/{id}

AttributesDescription
id
conditional
The workspaces’ unique ID, if replacing it.*
  • The behavior of PUT endpoints is the following: if the request payload does not contain an entity’s primary key (id for workspaces), the entity will be created with the given payload. If the request payload does contain an entity’s primary key, the payload will “replace” the entity specified by the given primary key. If the primary key is not that of an existing entity, 404 NOT FOUND will be returned.

Request body

AttributeDescription
nameThe workspace name.

Response

If creating the entity:

  1. HTTP 201 Created

If replacing the entity:

  1. HTTP 200 OK
  1. {
  2. "comment": null,
  3. "config": {
  4. "meta": null,
  5. "portal": false,
  6. "portal_access_request_email": null,
  7. "portal_approved_email": null,
  8. "portal_auth": null,
  9. "portal_auth_conf": null,
  10. "portal_auto_approve": null,
  11. "portal_cors_origins": null,
  12. "portal_developer_meta_fields": "[{\"label\":\"Full Name\",\"title\":\"full_name\",\"validator\":{\"required\":true,\"type\":\"string\"}}]",
  13. "portal_emails_from": null,
  14. "portal_emails_reply_to": null,
  15. "portal_invite_email": null,
  16. "portal_reset_email": null,
  17. "portal_reset_success_email": null,
  18. "portal_token_exp": null
  19. },
  20. "created_at": 1557504202,
  21. "id": "c663cca5-c6f6-474a-ae44-01f62aba16a9",
  22. "meta": {
  23. "color": null,
  24. "thumbnail": null
  25. },
  26. "name": "rocket-team"
  27. }

Retrieve a workspace

Endpoint

/workspaces/{name or id}

AttributesDescription
name or id
required
The unique identifier or the name of the workspace to retrieve

Response

  1. HTTP 200 OK
  1. {
  2. "config": {
  3. "portal": false,
  4. "portal_developer_meta_fields": "[{\"label\":\"Full Name\",\"title\":\"full_name\",\"validator\":{\"required\":true,\"type\":\"string\"}}]"
  5. },
  6. "created_at": 1557504202,
  7. "id": "c663cca5-c6f6-474a-ae44-01f62aba16a9",
  8. "meta": { },
  9. "name": "rocket-team"
  10. }

Retrieve workspace metadata

Endpoint

/workspaces/{name or id}/meta

AttributesDescription
name or id
required
The unique identifier or the name of the workspace to retrieve

Response

  1. HTTP 200 OK
  1. {
  2. "counts": {
  3. "acls": 1,
  4. "basicauth_credentials": 1,
  5. "consumers": 1234,
  6. "files": 41,
  7. "hmacauth_credentials": 1,
  8. "jwt_secrets": 1,
  9. "keyauth_credentials": 1,
  10. "oauth2_authorization_codes": 1,
  11. "oauth2_credentials": 1,
  12. "oauth2_tokens": 1,
  13. "plugins": 5,
  14. "rbac_roles": 3,
  15. "rbac_users": 12,
  16. "routes": 15,
  17. "services": 2,
  18. "ssl_certificates": 1,
  19. "ssl_servers_names": 1,
  20. "targets": 1,
  21. "upstreams": 1
  22. }
  23. }

Delete a workspace

Endpoint

/workspaces/{name or id}

AttributesDescription
name or id
required
The unique identifier or the name of the workspace to delete
cascadeThe cascade option lets you delete a workspace and all of its entities in one request.

Response

  1. HTTP 204 No Content

Perform a cascading delete. Normally, deleting a workspace requires its entities to be deleted first. The cascade option lets you delete a workspace and all of its entities in one request.

  1. DELETE /workspaces/{name or id}?cascade=true

Update a workspace

Endpoint

/workspaces/{name or id}

AttributesDescription
name or id
required
The unique identifier or the name of the workspace to patch

Request body

AttributesDescription
commentA string describing the workspace

The behavior of PATCH endpoints prevents the renaming of a workspace.

Response

  1. HTTP 200 OK
  1. {
  2. "comment": "this is a sample comment in the patch request",
  3. "config": {
  4. "meta": null,
  5. "portal": false,
  6. "portal_access_request_email": null,
  7. "portal_approved_email": null,
  8. "portal_auth": null,
  9. "portal_auth_conf": null,
  10. "portal_auto_approve": null,
  11. "portal_cors_origins": null,
  12. "portal_developer_meta_fields": "[{\"label\":\"Full Name\",\"title\":\"full_name\",\"validator\":{\"required\":true,\"type\":\"string\"}}]",
  13. "portal_emails_from": null,
  14. "portal_emails_reply_to": null,
  15. "portal_invite_email": null,
  16. "portal_reset_email": null,
  17. "portal_reset_success_email": null,
  18. "portal_token_exp": null
  19. },
  20. "created_at": 1557509909,
  21. "id": "c543d2c8-d297-4c9c-adf5-cd64212868fd",
  22. "meta": {
  23. "color": null,
  24. "thumbnail": null
  25. },
  26. "name": "green-team"
  27. }

Access an endpoint within a workspace

Endpoint

/{name or id}/{endpoint}

AttributesDescription
name or id
required
The unique identifier or the name of the workspace to target.

Can be used with any request method.

Target entities within a specified workspace by adding the workspace name or ID prefix before any entity endpoint.

  1. http://<ADMIN_API_HOSTNAME>:8001/<WORKSPACE_NAME|WORKSPACE_ID>/<ENDPOINT>

For example, to target services in the workspace SRE:

  1. http://localhost:8001/SRE/services