Create a GPG key for the authenticated user
POST
/user/gpg_keys https://api.github.com
Adds a GPG key to the authenticated user's GitHub account.
OAuth app tokens and personal access tokens (classic) need the write:gpg_key scope to use this endpoint.
Request Body
application/json
required
{ name?: string;armored_public_key: string; }
Responses
201 application/json
Response
interface GpgKey {
id: number;
name?: string | null;
primary_key_id: number | null;
key_id: string;
public_key: string;
emails: { email?: string;verified?: boolean; }[];
subkeys: {
id?: number;
primary_key_id?: number;
key_id?: string;
public_key?: string;
emails?: { email?: string;verified?: boolean; }[];
subkeys?: unknown[];
can_sign?: boolean;
can_encrypt_comms?: boolean;
can_encrypt_storage?: boolean;
can_certify?: boolean;
created_at?: string;
expires_at?: string | null;
raw_key?: string | null;
revoked?: boolean;
}[];
can_sign: boolean;
can_encrypt_comms: boolean;
can_encrypt_storage: boolean;
can_certify: boolean;
created_at: string;
expires_at: string | null;
revoked: boolean;
raw_key: string | null;
}
id: number;
name?: string | null;
primary_key_id: number | null;
key_id: string;
public_key: string;
emails: { email?: string;verified?: boolean; }[];
subkeys: {
id?: number;
primary_key_id?: number;
key_id?: string;
public_key?: string;
emails?: { email?: string;verified?: boolean; }[];
subkeys?: unknown[];
can_sign?: boolean;
can_encrypt_comms?: boolean;
can_encrypt_storage?: boolean;
can_certify?: boolean;
created_at?: string;
expires_at?: string | null;
raw_key?: string | null;
revoked?: boolean;
}[];
can_sign: boolean;
can_encrypt_comms: boolean;
can_encrypt_storage: boolean;
can_certify: boolean;
created_at: string;
expires_at: string | null;
revoked: boolean;
raw_key: string | null;
}
Redirects
304
Not modified
unknown
Client Errors
401 application/json
Requires authentication
interface BasicError {
message?: string;
documentation_url?: string;
url?: string;
status?: string;
}
message?: string;
documentation_url?: string;
url?: string;
status?: string;
}
403 application/json
Forbidden
interface BasicError {
message?: string;
documentation_url?: string;
url?: string;
status?: string;
}
message?: string;
documentation_url?: string;
url?: string;
status?: string;
}
404 application/json
Resource not found
interface BasicError {
message?: string;
documentation_url?: string;
url?: string;
status?: string;
}
message?: string;
documentation_url?: string;
url?: string;
status?: string;
}
422 application/json
Validation failed, or the endpoint has been spammed.
interface ValidationError {
message: string;
documentation_url: string;
errors?: {
resource?: string;
field?: string;
message?: string;
code: string;
index?: number;
value?: string[] | string | number | null;
}[];
}
message: string;
documentation_url: string;
errors?: {
resource?: string;
field?: string;
message?: string;
code: string;
index?: number;
value?: string[] | string | number | null;
}[];
}