# Authefy GraphQL API

## Schema

{% file src="<https://3164607650-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Ma8-WxGNNOdCdyQQvUH%2F-Mb9K8DpI-PdeuzNiREg%2F-Mb9LOWQfYE8jWu3ZuAl%2Fschema.graphql?alt=media&token=e3851e27-6c93-4d72-a414-fa1d070301d7>" %}
authefy.graphql
{% endfile %}

## Internal API Flow

#### Admin registers in Authefy GraphQL API with their email

```graphql
mutation {
  createAdmin(input:{
    username:"hov@email.com"
    password:"8b7b748af874504b98d263e8d070fec3"
  }) {
    id
    username
    type
    isEmailVerified
  }
}
```

#### Admin verifies their email

![Click the link and it will verify the admin's email](https://3164607650-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Ma8-WxGNNOdCdyQQvUH%2F-Mb9FUxuKkPDL0PIvT2e%2F-Mb9FuMuyyxkRlDjg_eP%2Fimage.png?alt=media\&token=548fb5ca-701a-496e-abb2-46539f6339ec)

#### Admin creates a new application

```graphql
mutation {
  createApplication(input:{
    name:"Demo Application" #name of application
    domainName:"https://demo-app.ph" #(optional) home url of the application
    webhookURI: "https://demo-app.ph/hook" #(optional) router where Authefy will send user events 
    requireEmailVerification: true #(optional) send email verification to application users after regisration
    redirectionURIAfterEmailVerification: "https://demo-app.ph/home" #(optional) landing page where the user will be redirected after verifying their email
    usernameFormat: EMAIL #(optional) force users to use formatted usernames. by default, user can register any string as username
  }) {
    id
    name
    domainName
    webhookURI
    accessKeys
    usernameFormat
    requireEmailVerification
    redirectionURIAfterEmailVerification
  }
}
```

#### Admin generates a new application access key

```graphql
mutation {
  generateApplicationAccessKey(id: "application-id")
  # returns an access-key
}
```
