# Create a vendor group

Creates a vendor group in the caller's vendor directory from a curated writable request and returns the created group, scoped server-side to the caller's organization. Requires an Idempotency-Key header (enforced at the gateway). Group names are unique per organization among active groups.

Endpoint: POST /public/v1/vendors/groups
Version: Beta

## Request body:

  - `application/json` (unknown)
    The writable fields accepted when creating a vendor group. The organization is
derived from the caller's access token; ids, membership counts, and timestamps are
assigned by the server.

## Request fields (application/json):

  - `name` (string, required)
    Human-readable display name for the new group. Required and must be non-blank after
surrounding whitespace is trimmed; at most 255 characters. Must not duplicate the name
of an active group in the caller's organization — a duplicate is rejected with
ALREADY_EXISTS rather than creating a second group.

  - `description` (string)
    Free-text description of the group; at most 1024 characters. Omit when the caller has
no copy to store — an omitted description reads back absent on the created group.

## Response 200:

  - `200` (unknown)
    A successful response.

## Response 200 fields (application/json):

  - `vendorGroup` (object, required)
    A vendor group in the caller's vendor directory, curated for public API consumers.
A vendor group is the customer's own named collection over the third parties they
track (e.g. by business unit or risk tier).

  - `vendorGroup.id` (string, required)
    Server-generated unique identifier of the group. Pass this back when addressing
a specific group.

  - `vendorGroup.name` (string, required)
    Human-readable display name of the group; unique within the caller's organization.

  - `vendorGroup.description` (string)
    Free-text description of the group. Absent when never set, which is
distinguishable from an explicitly empty description.

  - `vendorGroup.memberCount` (string, required)
    Number of vendors currently in this group. Maintained by the service and
read-only on this surface.

  - `vendorGroup.createdAt` (string, required)
    Time the group was created.

  - `vendorGroup.updatedAt` (string, required)
    Time the group's metadata was last updated.

## Response 400:

  - `400` (unknown)
    INVALID_ARGUMENT: name is missing, blank, or longer than 255 characters, or description is longer than 1024 characters.

## Response 401:

  - `401` (unknown)
    UNAUTHENTICATED: access token is absent, malformed, or missing the required organization claim.

## Response 403:

  - `403` (unknown)
    PERMISSION_DENIED: access token does not include the vendor-directory.write scope.

## Response 409:

  - `409` (unknown)
    ALREADY_EXISTS: an active group with the same name already exists in the caller's organization.

## Response default:

  - `default` (unknown)
    An unexpected error response.

## Response default fields (application/json):

  - `code` (integer, required)
    The status code, which should be an enum value of
[google.rpc.Code][google.rpc.Code].

  - `message` (string, required)
    A developer-facing error message, which should be in English. Any
user-facing error message should be localized and sent in the
[google.rpc.Status.details][google.rpc.Status.details] field, or localized
by the client.

  - `details` (array, required)
    A list of messages that carry the error details.  There is a common set of
message types for APIs to use.

  - `details.@type` (string)
    A URL/resource name that uniquely identifies the type of the serialized
protocol buffer message. This string must contain at least
one "/" character. The last segment of the URL's path must represent
the fully qualified name of the type (as in
`path/google.protobuf.Duration`). The name should be in a canonical form
(e.g., leading "." is not accepted).
In practice, teams usually precompile into the binary all types that they
expect it to use in the context of Any. However, for URLs which use the
scheme `http`, `https`, or no scheme, one can optionally set up a type
server that maps type URLs to message definitions as follows:
* If no scheme is provided, `https` is assumed.
* An HTTP GET on the URL must yield a [google.protobuf.Type][]
value in binary format, or produce an error.
* Applications are allowed to cache lookup results based on the
URL, or have them precompiled into a binary to avoid any
lookup. Therefore, binary compatibility needs to be preserved
on changes to types. (Use versioned type names to manage
breaking changes.)

Note: this functionality is not currently available in the official
protobuf release, and it is not used for type URLs beginning with
type.googleapis.com. As of May 2023, there are no widely used type server
implementations and no plans to implement one.
Schemes other than `http`, `https` (or the empty scheme) might be
used with implementation specific semantics.

