# Make your first API request

Five calls take you from credentials to a posted video: get a token, create a community, create a group in it, add a member, and post a video. Run them against QA first (see [Environments, credentials, and test data](https://begenuin.com/developers/developer-resources/guides/environments-credentials-and-test-data)).

**1. Get an access token** (see [Generate an access token](https://begenuin.com/developers/developer-resources/api/generate-access-token-using-authentication-api))

```bash title="cURL"
curl -i -X POST https://api.qa.begenuin.com/api/thirdparty/auth \
  -H "Content-Type: application/json" \
  -d '{ "api_key": "<<YOUR_API_KEY>>", "api_secret": "<<YOUR_API_SECRET>>" }'
```

Read `gn-access-token` and `gn-refresh-token` from the response headers. Every call below sends the access token as a bearer token.

**2. Create a community** (see [Create a community](https://begenuin.com/developers/developer-resources/api/create-a-community-programmatically-using-community-api))

```bash title="cURL"
curl -X POST https://api.qa.begenuin.com/api/thirdparty/community/create \
  -H "Authorization: Bearer {{GN_ACCESS_TOKEN}}" \
  -H "Content-Type: application/json" \
  -d '{ "handle": "trail-runners", "name": "Trail Runners" }'
```

Keep the community's UUID from the response.

**3. Create a group in it** (see [Create a group in a community](https://begenuin.com/developers/developer-resources/api/create-a-group-programmatically-within-community-using-create-group-api))

`POST /api/thirdparty/group/create` with the community's UUID. The group is where videos are posted. Its visibility and "who can post" rules decide which members can post through the API.

**4. Add a member** (see [Add members to a community](https://begenuin.com/developers/developer-resources/api/add-members-to-a-community-programmatically-api))

`POST /api/thirdparty/community/add_users`. Add an existing account by UUID or invite by phone number; a number without an account gets a pending account.

**5. Post a video** (see [Post a video to a group](https://begenuin.com/developers/developer-resources/api/post-and-share-a-video-within-a-group-using-the-post-video-api))

Request a signed upload URL for the video and the thumbnail, `PUT` the files, then post with the group's `chat_id`:

```bash title="cURL"
curl -X POST https://api.qa.begenuin.com/api/thirdparty/users/conversation/reply \
  -H "Authorization: Bearer {{GN_ACCESS_TOKEN}}" \
  -H "Content-Type: application/json" \
  -d '{ "chat_id": "{{CHAT_ID}}", "video_name": "{{VIDEO_FILE}}", "thumbnail_name": "{{THUMB_FILE}}",
        "aspect_ratio": "9:16", "duration": "8", "resolution": "1080x1920", "size": "5MB" }'
```

The response carries the post's `conversation_id` and its public `share_url`. The post is visible in the group feed and the community at once.

## Then render it

Show the community on your site with one script tag (see [Embed the Genuin Web SDK on your website](https://begenuin.com/developers/developer-resources/sdk/how-do-you-embed-and-configure-the-genuin-web-sdk-on-your-website)) or in your app with the mobile SDK for your platform (see [Integrate the Genuin iOS SDK](https://begenuin.com/developers/developer-resources/sdk/developer/genuin-sdk/native-compatibility/ios/how-to-integrate-and-power-your-brand-community-in-ios-apps), [Integrate the Genuin Android SDK](https://begenuin.com/developers/developer-resources/sdk/how-to-integrate-and-power-your-brand-community-in-android-apps), [Integrate the Genuin SDK with React Native apps](https://begenuin.com/developers/developer-resources/sdk/how-do-you-integrate-the-genuin-react-native-sdk-into-your-application), [Integrate the Genuin SDK with Flutter apps](https://begenuin.com/developers/developer-resources/sdk/how-do-you-integrate-the-genuin-flutter-sdk-into-your-application), and [Initialize the Genuin SDK and load a feed in Flutter](https://begenuin.com/developers/developer-resources/sdk/flutter-sdk-developer-reference-how-do-i-initialize-the-genuin-sdk-and-load-a-feed)), and sign members in with Auto Login (see [How Auto Login works](https://begenuin.com/developers/developer-resources/guides/genuin-auto-login)).
