Create a face

Design how a kind of object looks. A face holds one design per **variant** — `card` for a tile in a list, `detail` for a full page, `share` for a link preview. Give it only the variants you need; what is missing simply is not offered. **Two ways to build a view.** Either write the design inline in `content`, as HTML or SVG with `{{.metadata.name}}`-style placeholders that are filled in from each object, or point `url` at a page of your own over `https`. Each view needs exactly one of the two — both, or neither, comes back as `400`. Inline designs can be up to 1 MB and must be HTML or SVG. Set `aspect_ratio` so that apps can leave the right amount of room, and `interactive` if the design responds to taps and clicks. Face names have to be unique within your organization. Requires the `faces.create` permission.

POST
/faces
AuthorizationBearer <token>

The access token returned after a successful sign-in, sent as Authorization: Bearer <access_token>.

It identifies the person and the organization they are working in, and it lasts about fifteen minutes. When it runs out, use their refresh token at POST /auth/refresh-token instead of asking them to sign in again.

In: header

Request Body

application/json

The face to create.

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

curl -X POST "https://api.dual.network/faces" \  -H "Content-Type: application/json" \  -d '{    "name": "Festival wristband",    "views": [      {        "variant": "card",        "media_type": "image/svg+xml",        "aspect_ratio": "1/1",        "content": "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 400 400\"><text x=\"20\" y=\"40\">{{.metadata.name}}</text></svg>"      },      {        "variant": "detail",        "media_type": "text/html",        "content": "<main><h1>{{.metadata.name}}</h1><p>Tier {{.custom.tier}}</p></main>"      }    ]  }'
{
  "id": "665f1c2d4b1a2c3d4e5f6a7b"
}

{
  "code": 3,
  "message": "face view card must define exactly one of content or url"
}

{
  "code": 16,
  "message": "no auth provided"
}

{
  "code": 13,
  "message": "internal error"
}