How do I get my campaign ID?

squirion27
squirion27

Hi!

I'm fiddling with the API to try an make a small app, but I'm stuck very early on, as I don't see how I can fetch the campaign IDs for my campaigns, either through the API, or from the website.

I'm probably missing something very obvious there... any help is appreciated!

Thanks!

Comments

  • C4RB0N
    C4RB0N
    Posts: 61

    Hi friend!

    Does this page help at all with your questions? If not, I can send your question along to the devs :)

     

  • C4RB0N
    C4RB0N
    Posts: 61

    Hi @squirion27 - I realized I forgot to tag you. Just let us know if the above doesn't have what you need and we need to dig further into this!

  • vadercomplex
    vadercomplex
    Posts: 281

    Hello friend! I followed up with you via personal message; we hope we are able to answer your question. ☺ @squirion27

    Obsidian Portal Support Druid | [email protected]

  • squirion27
    squirion27
    Posts: 3

    Hi @C4RBON and @vadercomplex !



    Yes, I did peruse the API documentation. The issue is that all API calls seem to require the campaign_id as a call argument, and I cannot find a way to find the campaign_id for my campaigns (either from the website or the API).



    If you could send the question to the devs, it would be very helpful, thanks!

  • vadercomplex
    vadercomplex
    Posts: 281

    Sending over to our Devs now! @squirion27

    Obsidian Portal Support Druid | [email protected]

  • vadercomplex
    vadercomplex
    Posts: 281

    Thanks for your patience, my friend! @squirion27

    Our Devs told us to provide you with this help document which should give you the information you're looking for: 

    https://db4sgowjqfwig.cloudfront.net/campaigns/282936/assets/1547325/op_api_test.rb?1769919909

    Let us know if more help is needed ♥

    Obsidian Portal Support Druid | [email protected]

  • squirion27
    squirion27
    Posts: 3

    Thanks @vadercomplex! I'll have a look as soon as I have the time to return to that project!

  • dragondreams
    dragondreams
    Posts: 34

    In regards to the campaign_id, here is what ChatGPT did to create code that I could pull the campaign_id:  

    We found the Obsidian Portal campaign ID through the authenticated API's /v1/users/me endpoint, rather than trying to extract it from the campaign's website URL.

    The key distinction is that the campaign's human-readable URL slug and its internal API ID are different values.

    Our approach was:


    1. Authenticate to the Obsidian Portal API.


    2. Request GET /v1/users/me.


    3. Read the campaigns array in the response.


    4. Find the campaign whose slug matches the campaign you want.


    5. Use that entry's id field as the campaign_id in subsequent API requests.


    For our campaign, the slug was playgroundtheyawningportal.

    I verified this against the actual Python script in our GitHub repository. Here's a copy-ready answer for the community discussion:

    I was able to retrieve my Obsidian Portal campaign ID using the authenticated API.

    The trick was to call:

    GET https://api.obsidianportal.com/v1/users/me

    The JSON response includes a campaigns array. I found my campaign by matching its slug against the slug in its website URL, then took the id field from that campaign entry.

    For example, in Python:


    user = get_json("/v1/users/me") # Authenticated OAuth 1.0a request

    for campaign in user["campaigns"]:
    print(campaign["slug"], campaign["id"])

    That id is what I used for subsequent requests, such as:

    GET /v1/campaigns/{campaign_id}/wikis.json

    I used OAuth 1.0a authentication with my consumer key, consumer secret, access token, and access token secret.

    This worked for my campaign and allowed me to retrieve its wiki and character indexes. Hope it helps!

     

  • vadercomplex
    vadercomplex
    Posts: 281

    Thank you friend! Hope that works for you guys! And if there's any issue, you're welcomed to reach out. ☺ @squirion27

    Obsidian Portal Support Druid | [email protected]

Sign In or Register to comment.

November 2026
Sylvangarde

Read the feature post on the blog
Return to Obsidian Portal

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Discussions