The recent announcement about new functionality for Spaces endpoints said a new topics field was added to the Space object, but this seems to be topic_ids, which is what is documented and from some testing, is what works in practice. The OpenAPI specification also seems to be inconsistent with the documentation here, and lists a topics property rather than topic_ids.

2 Likes

Thank you for reporting this. To clarify, topics is the name of the expansion payload field. For example, requesting https://api.twitter.com/2/spaces/:id?expansions=topic_ids&topic.fields=name will return:

{
  "data": {
    "id": "(id of the space)",
    "state": "scheduled",
    "topic_ids": [
      "id of the topic"
    ]
  },
  "topics": [
    {
      "id": "id of the topic",
      "name": "topic name"
    }
  ]
}```
2 Likes

Hi is this thread alive?

When I tried it, the list of topic_ids was returned, but the topics object was not.

Hi! I can confirm that’s the correct query. Try this live request to see Space topics using Spaces search.

Please note that Topic names will appear in the includes object. Topics will be returned only if the creator of the Space set at least one when starting or scheduling the Space.

2 Likes

Hi @i_am_daniele, thanks for your reply!

I could see topic object in includes object, thanks a lot! :slight_smile:

Hi @i_am_daniele ,

Now I see why so many people are facing this problem. It’s because the expansions enum element is missing from the official endpoint reference.

enum (invited_user_ids , speaker_ids , creator_id , host_ids )

This confusion is caused by the fact that the topic_ids is indeed an element of expansions, given the specification of the includes field, but the official reference does not describe it.

Thank you :slight_smile:

1 Like

Thank you! This is indeed an inconsistency with the documentation. We will update the documentation to reflect that topic_ids is part of the expansions enum.

1 Like