I’m trying to use the create_doc mutation to create a new doc in a specific workspace on Monday.com, but I’m encountering an error: Workspace not found. I’ve confirmed that the workspace_id is correct and matches the workspace where I want the doc to be created. Here’s my mutation:
mutation {
create_doc(location: {workspace: {workspace_id: 12345678, name: "New Doc", kind: private}}) {
id
}
}
Despite following the steps in the (site.developer.monday.com/api-reference/reference/docs), I still get this error. I’ve also verified that the workspace exists and that I have the appropriate permissions to create docs in it.
Could there be a problem with the workspace_id format or the workspace’s visibility settings? Is there something I’m missing in the mutation setup? Any help or tips would be greatly appreciated.
It looks like there may be a syntax or formatting issue with your mutation. Here are a few things to check and a revised approach to try.
Possible Issues:
Incorrect workspace_id Structure
In the create_doc mutation, the workspace_id should be a direct integer value, not nested inside {workspace: {}}.
Your current structure is likely causing the API to not recognize the workspace properly.
Incorrect Mutation Syntax
The "name" and "kind" fields should not be inside the location object. They should be separate parameters.
Visibility Settings
Ensure that your workspace is not private or restricted in a way that prevents API-created documents.
Check for API Token Permissions
If your token lacks permissions to create docs in that workspace, you may get this error. Try creating a doc manually in the workspace to confirm you have the right access.
Corrected Mutation:
Try using this version instead:
mutation {
create_doc(
name: "New Doc",
kind: private,
location: { workspace_id: 12345678 }
) {
id
}
}
Additional Debugging Steps:
Confirm the workspace_id by querying your workspaces:
query {
workspaces {
id
name
}
}
Make sure the ID you’re using is correct.
Test creating a doc without specifying a workspace to see if the issue is workspace-related: