curl \
-H "Authorization: Bearer API_KEY" \
-H 'Content-Type: application/json' \
-d '{"title": "ACME Profile"}' \
-X POST https://api.ayrshare.com/api/profiles
const API_KEY = "API_KEY";
fetch("https://api.ayrshare.com/api/profiles", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": `Bearer ${API_KEY}`
},
body: JSON.stringify({
title: "ACME Profile", // required
}),
})
.then((res) => res.json())
.then((json) => console.log(json))
.catch(console.error);
import requests
payload = {'title': 'ACME Profile'}
headers = {'Content-Type': 'application/json',
'Authorization': 'Bearer API_KEY'}
r = requests.post('https://api.ayrshare.com/api/profiles',
json=payload,
headers=headers)
print(r.json())
<?php
require 'vendor/autoload.php'; // Composer auto-loader using Guzzle. See .../guzzlephp.org/en/stable/overview.html
$client = new GuzzleHttp\Client();
$res = $client->request(
'POST',
'https://api.ayrshare.com/api/profiles',
[
'headers' => [
'Content-Type' => 'application/json',
'Authorization' => 'Bearer API_KEY'
],
'title' => ['ACME Profile'],
]
);
echo json_encode(json_decode($res->getBody()), JSON_PRETTY_PRINT);
package main
import (
"bytes"
"encoding/json"
"log"
"net/http"
)
func main() {
message := map[string]interface{}{
"title": "ACME Profile"
}
bytesRepresentation, err := json.Marshal(message)
if err != nil {
log.Fatalln(err)
}
req, _ := http.NewRequest("POST", "https://api.ayrshare.com/api/profiles",
bytes.NewBuffer(bytesRepresentation))
req.Header.Add("Content-Type", "application/json; charset=UTF-8")
req.Header.Add("Authorization", "Bearer API_KEY")
res, err := http.DefaultClient.Do(req)
if err != nil {
log.Fatal("Error:", err)
}
res.Body.Close()
}
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
namespace CreateProfilePOSTRequest_csharp
{
class CreateProfile
{
static async Task Main(string[] args)
{
string API_KEY = "API_KEY";
string url = "https://api.ayrshare.com/api/profiles";
string json = "{\"title\": \"ACME Profile\"}";
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Add("Authorization", "Bearer " + API_KEY);
try
{
var content = new StringContent(json, Encoding.UTF8, "application/json");
HttpResponseMessage response = await client.PostAsync(url, content);
response.EnsureSuccessStatusCode();
string responseBody = await response.Content.ReadAsStringAsync();
Console.WriteLine(responseBody);
}
catch (HttpRequestException e)
{
Console.WriteLine($"Error: {e.Message}");
}
}
}
}
}
{
"status": "success",
"title": "Digg It",
"refId": "140b8709bd6ade099b242d895e268fb886130c53",
"profileKey": "7TVRLEZ-24A43C0-NJW0Z82-F11984N",
"messagingActive": true // true if messaging for this user profile is active
}
{
"action": "create",
"status": "error",
"code": 146,
"message": "Profile title already exists."
}
{
"action": "create profiles",
"status": "error",
"code": 480,
"message": "このアカウントでは Demo Profiles が有効化されていません。Demo Profiles には Enterprise plan が必要で、Ayrshare によって有効化される必要があります。"
}
Profiles
User Profile を作成する
Primary Profile の下に新しい User Profile を作成します。
POST
/
profiles
curl \
-H "Authorization: Bearer API_KEY" \
-H 'Content-Type: application/json' \
-d '{"title": "ACME Profile"}' \
-X POST https://api.ayrshare.com/api/profiles
const API_KEY = "API_KEY";
fetch("https://api.ayrshare.com/api/profiles", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": `Bearer ${API_KEY}`
},
body: JSON.stringify({
title: "ACME Profile", // required
}),
})
.then((res) => res.json())
.then((json) => console.log(json))
.catch(console.error);
import requests
payload = {'title': 'ACME Profile'}
headers = {'Content-Type': 'application/json',
'Authorization': 'Bearer API_KEY'}
r = requests.post('https://api.ayrshare.com/api/profiles',
json=payload,
headers=headers)
print(r.json())
<?php
require 'vendor/autoload.php'; // Composer auto-loader using Guzzle. See .../guzzlephp.org/en/stable/overview.html
$client = new GuzzleHttp\Client();
$res = $client->request(
'POST',
'https://api.ayrshare.com/api/profiles',
[
'headers' => [
'Content-Type' => 'application/json',
'Authorization' => 'Bearer API_KEY'
],
'title' => ['ACME Profile'],
]
);
echo json_encode(json_decode($res->getBody()), JSON_PRETTY_PRINT);
package main
import (
"bytes"
"encoding/json"
"log"
"net/http"
)
func main() {
message := map[string]interface{}{
"title": "ACME Profile"
}
bytesRepresentation, err := json.Marshal(message)
if err != nil {
log.Fatalln(err)
}
req, _ := http.NewRequest("POST", "https://api.ayrshare.com/api/profiles",
bytes.NewBuffer(bytesRepresentation))
req.Header.Add("Content-Type", "application/json; charset=UTF-8")
req.Header.Add("Authorization", "Bearer API_KEY")
res, err := http.DefaultClient.Do(req)
if err != nil {
log.Fatal("Error:", err)
}
res.Body.Close()
}
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
namespace CreateProfilePOSTRequest_csharp
{
class CreateProfile
{
static async Task Main(string[] args)
{
string API_KEY = "API_KEY";
string url = "https://api.ayrshare.com/api/profiles";
string json = "{\"title\": \"ACME Profile\"}";
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Add("Authorization", "Bearer " + API_KEY);
try
{
var content = new StringContent(json, Encoding.UTF8, "application/json");
HttpResponseMessage response = await client.PostAsync(url, content);
response.EnsureSuccessStatusCode();
string responseBody = await response.Content.ReadAsStringAsync();
Console.WriteLine(responseBody);
}
catch (HttpRequestException e)
{
Console.WriteLine($"Error: {e.Message}");
}
}
}
}
}
{
"status": "success",
"title": "Digg It",
"refId": "140b8709bd6ade099b242d895e268fb886130c53",
"profileKey": "7TVRLEZ-24A43C0-NJW0Z82-F11984N",
"messagingActive": true // true if messaging for this user profile is active
}
{
"action": "create",
"status": "error",
"code": 146,
"message": "Profile title already exists."
}
{
"action": "create profiles",
"status": "error",
"code": 480,
"message": "このアカウントでは Demo Profiles が有効化されていません。Demo Profiles には Enterprise plan が必要で、Ayrshare によって有効化される必要があります。"
}
Primary Profile の下に新しいプロファイルを作成します。User Profile が正常に作成されると、API レスポンスには新しく作成されたプロファイルに関連付けられた Profile Key が含まれます。ユーザーの代わりに API 呼び出しを行うために必要になるため、Profile Key はシステム内に安全に保管してください。
セキュリティ上の理由から、Profile Keys は次の 2 つの特定のケースでのみ返されます。
- User Profile 作成時: 新しい User Profile が作成されたとき。
- Ayrshare Dashboard 内: Ayrshare Dashboard 内で各プロファイルの Profile Key を確認できます。User Profile に切り替え、Profile Key ページに移動します。
ソーシャルネットワークの管理
disableSocial フィールドを使用して、表示から(追加/削除)ソーシャルネットワークを管理します。詳細は Manage Social Accounts を参照してください。アクティブな User Profiles の管理
アクティブな User Profiles の管理 に関する推奨事項をこちらで参照してください。重要なセキュリティ上の考慮事項
- Profile Keys を公開して共有したり、クライアントサイドコードや公開リポジトリで公開したりしないでください。
- Profile Keys は、User Profiles へのアクセスの認証と承認に使用される機密資格情報です。
- ユーザーデータの整合性と機密性を維持するために、適切なアクセス制御を持つシステム内に Profile Keys を安全に保管することが重要です。
- セキュリティ上の理由から、Profile Key は API を使用して再度取得することはできません。ただし、ダッシュボード から Profile Key を取得できます。
refIdも、プロファイルをエンドポイントの戻り値に関連付けるために保管してください。
Header Parameters
Body Parameters
string
必須
新しいプロファイルのタイトル。一意である必要があります。このタイトルはソーシャルアカウントリンクページに表示されます。
boolean
デフォルト:false
このユーザープロファイルに対してメッセージング機能を有効化するには true に設定します。事前に Ayrshare アカウントでメッセージング機能が有効になっている必要があります。
boolean
デフォルト:false
ソーシャルアカウントリンクページのトップヘッダーを非表示にします。
boolean
デフォルト:false
このユーザープロファイルのみ、ソーシャルアカウントリンクページの会社ロゴを非表示にします。他のプロファイルのアカウント全体のロゴには影響しません。他のプロファイルではブランディングを維持したまま、個々のパートナープロファイルをホワイトラベル化するのに便利です。
string
ソーシャルアカウントリンクページのヘッダーを変更します。設定されていない場合、“Social Accounts for “title"" と表示されます(“title” はプロファイルのタイトル)。
array
このユーザーのプロファイルで無効化されたソーシャルネットワークの配列。プライマリプロファイルの無効化されたソーシャルネットワークのリストが優先されます。利用可能なネットワーク:
bluesky、facebook、gmb、instagram、linkedin、pinterest、reddit、snapchat、telegram、threads、tiktok、twitter、youtube。詳細は ソーシャルネットワークの有効化または無効化 を参照してください。boolean
デフォルト:false
team: true を設定して、チームメンバーとして新しいユーザープロファイルを作成します。email フィールドは招待メールの送信に使用されます。要件の詳細については、チームメンバーの招待 を参照してください。string
チームメンバー招待が送信される有効なメールアドレス。
team: true の場合は必須です。string
ソーシャルアカウントリンクページのサブヘッダーを変更します。現在は “Click an icon to link a social network” と表示されています。削除するには空の文字列を設定します。ヘルプリンク の変更方法を参照してください。
array
文字列の配列を使用してユーザープロファイルにタグを付けます。これらのタグは、ユーザープロファイルを効果的に分類・管理するための内部組織ツールとして機能します。
boolean
デフォルト:false
プロファイルを Demo User Profile として作成します。これは 30 日間の評価用プロファイルで、30 日経過後に自動的に標準の User Profile に変換されます。Demo User Profiles は Enterprise plan で利用可能で、アカウントで有効化されている必要があります。詳細については お問い合わせ ください。有効化されていない場合、HTTP 403 とエラーコード 480 が返されます。
curl \
-H "Authorization: Bearer API_KEY" \
-H 'Content-Type: application/json' \
-d '{"title": "ACME Profile"}' \
-X POST https://api.ayrshare.com/api/profiles
const API_KEY = "API_KEY";
fetch("https://api.ayrshare.com/api/profiles", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": `Bearer ${API_KEY}`
},
body: JSON.stringify({
title: "ACME Profile", // required
}),
})
.then((res) => res.json())
.then((json) => console.log(json))
.catch(console.error);
import requests
payload = {'title': 'ACME Profile'}
headers = {'Content-Type': 'application/json',
'Authorization': 'Bearer API_KEY'}
r = requests.post('https://api.ayrshare.com/api/profiles',
json=payload,
headers=headers)
print(r.json())
<?php
require 'vendor/autoload.php'; // Composer auto-loader using Guzzle. See .../guzzlephp.org/en/stable/overview.html
$client = new GuzzleHttp\Client();
$res = $client->request(
'POST',
'https://api.ayrshare.com/api/profiles',
[
'headers' => [
'Content-Type' => 'application/json',
'Authorization' => 'Bearer API_KEY'
],
'title' => ['ACME Profile'],
]
);
echo json_encode(json_decode($res->getBody()), JSON_PRETTY_PRINT);
package main
import (
"bytes"
"encoding/json"
"log"
"net/http"
)
func main() {
message := map[string]interface{}{
"title": "ACME Profile"
}
bytesRepresentation, err := json.Marshal(message)
if err != nil {
log.Fatalln(err)
}
req, _ := http.NewRequest("POST", "https://api.ayrshare.com/api/profiles",
bytes.NewBuffer(bytesRepresentation))
req.Header.Add("Content-Type", "application/json; charset=UTF-8")
req.Header.Add("Authorization", "Bearer API_KEY")
res, err := http.DefaultClient.Do(req)
if err != nil {
log.Fatal("Error:", err)
}
res.Body.Close()
}
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
namespace CreateProfilePOSTRequest_csharp
{
class CreateProfile
{
static async Task Main(string[] args)
{
string API_KEY = "API_KEY";
string url = "https://api.ayrshare.com/api/profiles";
string json = "{\"title\": \"ACME Profile\"}";
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Add("Authorization", "Bearer " + API_KEY);
try
{
var content = new StringContent(json, Encoding.UTF8, "application/json");
HttpResponseMessage response = await client.PostAsync(url, content);
response.EnsureSuccessStatusCode();
string responseBody = await response.Content.ReadAsStringAsync();
Console.WriteLine(responseBody);
}
catch (HttpRequestException e)
{
Console.WriteLine($"Error: {e.Message}");
}
}
}
}
}
{
"status": "success",
"title": "Digg It",
"refId": "140b8709bd6ade099b242d895e268fb886130c53",
"profileKey": "7TVRLEZ-24A43C0-NJW0Z82-F11984N",
"messagingActive": true // true if messaging for this user profile is active
}
{
"action": "create",
"status": "error",
"code": 146,
"message": "Profile title already exists."
}
{
"action": "create profiles",
"status": "error",
"code": 480,
"message": "このアカウントでは Demo Profiles が有効化されていません。Demo Profiles には Enterprise plan が必要で、Ayrshare によって有効化される必要があります。"
}