Confluence connector fails with 400 when using space key — v2 API requires numeric space ID
Summary
The oikb documentation and README show that a Confluence space should be configured using its key:
sources:
- name: handbook
source: confluence:ENG
This does not work. Confluence Cloud's v2 API rejects the space key with 400 Bad Request when it appears as a path parameter. The only workaround is to manually look up the numeric space ID and use that instead — which contradicts the documented behavior and is not mentioned anywhere in the docs.
Description
The Confluence connector passes the space key directly to the /wiki/api/v2/spaces/{id}/pages endpoint:
resp = self._http.get(
f"/api/v2/spaces/{self.space_key}/pages",
params=params,
)
Confluence Cloud's v2 API only accepts a numeric space ID in that path parameter — not a space key string like ENG or TECH. Passing a key returns 400 Bad Request.
The key format (confluence:ENG) works fine for the /api/v2/spaces?keys=ENG lookup endpoint, but not for /api/v2/spaces/{id}/pages.
Workaround
Look up the numeric ID for your space first:
curl -u "user@company.com:TOKEN" \
"https://company.atlassian.net/wiki/api/v2/spaces?keys=ENG"
Then use the numeric id from the response in the source config:
source: confluence:9959866368 # numeric ID, not key
Expected Behaviour
confluence:ENG should work as documented. The connector should resolve the space key to a numeric ID via /api/v2/spaces?keys={key} before fetching pages.
Suggested Fix
Add a key→ID resolution step in ConfluenceConnector.__init__ or build_manifest:
resp = self._http.get("/api/v2/spaces", params={"keys": self.space_key})
resp.raise_for_status()
results = resp.json().get("results", [])
if results:
self.space_key = results[0]["id"]
Environment
- Confluence Cloud
- oikb v0.3.5
Confluence connector fails with 400 when using space key — v2 API requires numeric space ID
Summary
The oikb documentation and README show that a Confluence space should be configured using its key:
This does not work. Confluence Cloud's v2 API rejects the space key with
400 Bad Requestwhen it appears as a path parameter. The only workaround is to manually look up the numeric space ID and use that instead — which contradicts the documented behavior and is not mentioned anywhere in the docs.Description
The Confluence connector passes the space key directly to the
/wiki/api/v2/spaces/{id}/pagesendpoint:Confluence Cloud's v2 API only accepts a numeric space ID in that path parameter — not a space key string like
ENGorTECH. Passing a key returns400 Bad Request.The key format (
confluence:ENG) works fine for the/api/v2/spaces?keys=ENGlookup endpoint, but not for/api/v2/spaces/{id}/pages.Workaround
Look up the numeric ID for your space first:
Then use the numeric
idfrom the response in the source config:Expected Behaviour
confluence:ENGshould work as documented. The connector should resolve the space key to a numeric ID via/api/v2/spaces?keys={key}before fetching pages.Suggested Fix
Add a key→ID resolution step in
ConfluenceConnector.__init__orbuild_manifest:Environment